[1.8.0] git checkout refs/heads/foo checks out branch foo
- From
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
- Date
- Feb 7, 2011, 11:01 UTC
- Message-ID
- <alpine.DEB.1.10.1102062234010.3788@debian>
Proposal:
'git checkout refs/heads/foo' (or 'git checkout heads/foo' for that matter) does not check out the branch, but instead detaches HEAD at foo. This is quite counter-intuitive (at least to me) and the same functionality can be achieved by using e.g. foo~0. Change the behavior so that the branch is actually checked out. This also applies to e.g. 'git rebase master refs/heads/topic', which currently rebases a detached HEAD. There are probably other examples as well that I'm not aware of.
Risks:
Existing scripts may depend on the current behavior. It seems unlikely that many users depend on it. Most likely, they use foo~0 or foo^0 instead.
Migration plan:
Make 'git checkout refs/head/foo' emit a warning in the next 1.7.x explaining that its semantics will change in 1.8.0. Then change the behavior in 1.8.0 and remove the warning.