Git "ends left" when switching back to a branch from a disconnected head

For some commits in our repo (but not for everyone), if I check the commit and then return to the main branch, I get an unexpected warning that the commits remain:

# Check out one of the commits in question: $ git checkout dd33caa5b004b0e3bd449152f9335e40450db91c Note: checking out 'dd33caa5b004b0e3bd449152f9335e40450db91c'. You are in 'detached HEAD' state. You can look around, make experimental [...] HEAD is now at dd33caa... Organized DataStore build files, added cleanup targets. # Now switch back to the master branch so I can work: $ git checkout master Warning: you are leaving 17 commits behind, not connected to any of your branches: dd33caa Organized DataStore build files, added cleanup targets. 4916eec Fixes to C++ codegen to use maven features. a26291d Merge branch 'master' of [redacted origin repo address] 93ae0b9 Add protobuf 2.4.1 jar file to install scripts. Add QTDIR to build script. ... and 13 more. If you want to keep them by creating a new branch, this may be a good time to do so with: git branch new_branch_name dd33caa5b004b0e3bd449152f9335e40450db91c Switched to branch 'master' 

All the commits in question (as far as I can tell) are accessible from the master, and I didn’t make any commits during the state of a separate head (this is a pure clone of our repository). The history of the lead branch is as follows:

 * 04d7fcc (HEAD, origin/master, origin/HEAD, master) Removed files from DataS * ecaa2f5 Fixed .gitignore. * dd33caa Organized DataStore build files, added cleanup targets. * 4916eec Fixes to C++ codegen to use maven features. * a26291d Merge branch 'master' of [redacted] |\ | * 93ae0b9 Add protobuf 2.4.1 jar file to install scripts. Add QTDIR to buil | * 3cba845 switched to protobug 2.4.1 jar files | * 1046d22 fixed GATEWAY_ROOT | * ebcda06 edit windows build scripting path for new repo location | * bda1e17 add windows build scripts from old repo * | 371883d Merge branch 'master' of [redacted] |\ \ | |/ | * 771c579 Fix MCast and RMCast service names in gateway manager config * | 864fb25 First cut at DataStore code generation update to sync with refact |/ * f505e46 Testing new repository * 111d89a Merge branch 'master' of [redacted] 

Any idea what could be happening here? It seems that it is connected to one specific user, and I can play it using Git 1.7.9.6 on OSX and Git 1.7.9.5 on Ubuntu, but not from 1.8.0 on Ubuntu ... so a Git error, maybe? I don't see anything in the release notes, though ...

+4
source share
1 answer

Yes, it looks like a Git bug. If you want to know what is fixed, you can do the division in half. Clone git.git , check the version that is broken, and make sure that the problem has occurred, check the latter and make sure that it is fixed, and then do a halving to find which fix is ​​fixed:

 $ git clone git://github.com/git/git.git $ cd git $ git checkout v1.7.9.5 $ make $ (cd my-repo && /path/to/my/git checkout dd33caa && /path/to/my/git checkout master 2>&1 | grep "leaving .* commits behind") $ git checkout v1.8.0 $ make $ (cd my-repo && /path/to/my/git checkout dd33caa && /path/to/my/git checkout master 2>&1 | grep "leaving .* commits behind") # if the above gave the expected results: $ git bisect start v1.7.9.5 v1.8.0 $ git bisect run bash -c "make && cd my-repo && /path/to/my/git checkout dd33caa && (! /path/to/my/git checkout master 2>&1 | grep -q 'leaving .* commits behind')" 

This should leave you with a fix that fixed your error. Please note that we are doing the opposite of the usual halving, in which you are trying to find the commit that introduced the error.

+5
source

Source: https://habr.com/ru/post/1447317/


All Articles