首页 > 解决方案 > 如何从非跟踪代码更新 git master

问题描述

如何从非跟踪代码更新 git master

鉴于一些代码以 tar.gz 的形式出现。这是master的更新代码。
但这项工作是在 git 之外完成的。

假设我想以我的主人身份更新这个新代码。

怎么可能做到这一点

标签: git

解决方案


查找 tar.gz 中的内容是从项目的哪个版本开始自行开发的。

git checkout starting-revision-id
git rm * # remove everything
tar zxvf the-file.tar.gz
git add .
git rm --cached the-file.tar.gz # just in case
git commit -m "Stuff done on the tar.gz" --author="Not me"
# if you want to set master over here:
git branch -f master
# if you want to push to a remote master branch:
git push some-remote HEAD:master

推荐阅读