Git 汞相的吉特当量?
在mercurial中,我经常使用秘密变更集来跟踪我的工作,这些变更集还没有完全准备好推进。然后,如果我需要对某个文件进行紧急更改,我可以更新到公共版本,进行更改并推送它,而不必担心未完成的更改集被推送 即:Git 汞相的吉特当量?,git,version-control,mercurial,version-control-migration,mercurial-phases,Git,Version Control,Mercurial,Version Control Migration,Mercurial Phases,在mercurial中,我经常使用秘密变更集来跟踪我的工作,这些变更集还没有完全准备好推进。然后,如果我需要对某个文件进行紧急更改,我可以更新到公共版本,进行更改并推送它,而不必担心未完成的更改集被推送 即: hg提交-sm“部分工作” #糟了,prod掉下来了 hg-up-r hg commit-m“Fixin prod” 冒出 1传出更改,“Fixin prod” 汞推力 hg-rebase-r-d。 #后来 hg提交——修改-m“已完成的工作” 汞相-dr。 冒出 1传出更改,“已完成工作
hg提交-sm“部分工作”
#糟了,prod掉下来了
hg-up-r
hg commit-m“Fixin prod”
冒出
1传出更改,“Fixin prod”
汞推力
hg-rebase-r-d。
#后来
hg提交——修改-m“已完成的工作”
汞相-dr。
冒出
1传出更改,“已完成工作”
汞推力
在git中如何实现这一点?使用分支:
$ git checkout -b dev #create a new branch based on the current commit in master
# .... work ....
$ git commit -a -m 'super awesome new feature'
# oh noes, production crapped itself!
$ git checkout master
# ... fix ...
$ git commit -a -m 'fixed bug #666'
$ git push master
$ git checkout dev #since we created the branch with -b the first time, we're good now.
$ git merge master # update our dev branch with the changes in master
# ... work on new features ...
# all done and commited and tested
$ git checkout master
$ git merge dev && git branch -d dev # delete the dev branch
$ git push && profit
或者简单地使用:
我个人更喜欢分支方法,因为它更干净
在git中如何实现这一点
我从不使用默认行为“gitpush
”。要强制执行,可以将push.default
设置为“nothing
”。然后有两种推送方式:
remote..push
。对于我的github内容,我通常在我的.git/config
:
[remote "origin"]
...
push = refs/heads/export/*:refs/heads/*
export/
”放在那里。在我这样做之前,提交不会被“gitpush
”推送
$git push origin 3f42873:refs/heads/12345_foo
[remote "origin"]
...
push = refs/heads/export/*:refs/heads/*
$git push origin 3f42873:refs/heads/12345_foo