git:更新一个php脚本,但保留自己的更改 [英] git: update a php-script but keep own changes
问题描述
我正在用git跟踪我在PHP软件上的更改。我只有一个主分支和大约10次提交,第一次提交是该软件的原始版本1.0。
现在我看到,PHP软件的所有者发布1.1版。
对于我来说,更新软件的最简单方法是什么,但保留我自己的更改并将它们与git mergetool合并?我应该使用补丁或创建另一个分支与未更改的版本更新吗?
谢谢!
<$ c 典型的方法是在本地软件的顶部创建一个包含局部变化的分支$ c> git checkout origin / master
git checkout -b local
....编辑文件....
git commit
现在每当有上游更新时,您都可以使用rebase轻松地重新应用更改:
git fetch
git rebase origin / master
如果您已经有一些在master分支中合并历史记录,尝试使用raw,并使用'git diff'来产生一个完整的上游工作区 - 即使没有git工具,也可以简单地应用此包。
I'm tracking my changes on a PHP-software with git. I have only a master branch and about 10 commits, the first commit was the original version 1.0 of the software.
Now I saw, that the owner of the PHP-software released version 1.1.
What is the best an easiest way for me, to update the software, but keep my own changes too and merge them with git mergetool? Should I use patches or create another branch with the untouched version updates?
Thank you!
Typical approach is to create a branch with local changes (say "local") on top of the software:
git checkout origin/master
git checkout -b local
....edit files....
git commit
now whenever there is upstream update, you can easily reapply changes using rebase:
git fetch
git rebase origin/master
If you already have some merge history in master branch, try doing it raw and use 'git diff' to produce a complete patch of your work against upstream -- such package can be simply applied even without git tools.
这篇关于git:更新一个php脚本,但保留自己的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!