1

I am making some additions to a code on branch atomic_boron. After running into a bug, I ran the command:

git checkout HEAD^^

in order to get back to the (presumably) working state to make sure it actually did work. However, now whenever I run:

git checkout atomic_boron

it takes me to the old commit. However, git log shows that the newer commits still exist. If I checkout the most recent commit it puts me into a detached head state that I can't seem to get out of. While in the detached head state I have tried running:

git checkout -b wtf_detached_head
git checkout atomic_boron
git merge wtf_detached_head

but the merge claims that there are no differences between the branches.

tl;dr: All I want to do is reattach the head to the most recent commit on atomic_boron, but git insists that the commit be checked out in a detached head state.

Here is the output of reflog, if it helps:

b66c7bd HEAD@{0}: checkout: moving from b66c7bd68f926cf9bb8b0b531252e91599d086ca to atomic_boron
b66c7bd HEAD@{1}: checkout: moving from atomic_boron to b66c7bd68f926cf9bb8b0b531252e91599d086ca
b66c7bd HEAD@{2}: checkout: moving from wtf_detached_head to atomic_boron
b66c7bd HEAD@{3}: checkout: moving from atomic_boron to wtf_detached_head
b66c7bd HEAD@{4}: checkout: moving from wtf_detached_head to atomic_boron
b66c7bd HEAD@{5}: checkout: moving from b66c7bd68f926cf9bb8b0b531252e91599d086ca to wtf_detached_head
b66c7bd HEAD@{6}: checkout: moving from atomic_boron to b66c7bd68f926cf9bb8b0b531252e91599d086ca
b66c7bd HEAD@{7}: checkout: moving from b66c7bd68f926cf9bb8b0b531252e91599d086ca to atomic_boron
b66c7bd HEAD@{8}: checkout: moving from atomic_boron to b66c7bd68f926cf9bb8b0b531252e91599d086ca
b66c7bd HEAD@{9}: checkout: moving from master to atomic_boron
f99923a HEAD@{10}: checkout: moving from b66c7bd68f926cf9bb8b0b531252e91599d086ca to master
b66c7bd HEAD@{11}: checkout: moving from atomic_boron to b66c7bd68f926cf9bb8b0b531252e91599d086ca
b66c7bd HEAD@{12}: checkout: moving from b66c7bd68f926cf9bb8b0b531252e91599d086ca to atomic_boron
b66c7bd HEAD@{13}: checkout: moving from atomic_boron to b66c7bd68f926cf9bb8b0b531252e91599d086ca
b66c7bd HEAD@{14}: checkout: moving from atomic_boron to atomic_boron
b66c7bd HEAD@{15}: checkout: moving from master to atomic_boron
f99923a HEAD@{16}: checkout: moving from atomic_boron to master
b66c7bd HEAD@{17}: checkout: moving from 4808ed19b72af9d9b2f2dd075438284506f6cd2f to atomic_boron
4808ed1 HEAD@{18}: checkout: moving from atomic_boron to HEAD^^
b66c7bd HEAD@{19}: commit (amend): Ground and excited state boron densities are now being calculated and output.

EDIT: Here is the output of

git log --graph --oneline --decorate

* b66c7bd (HEAD, atomic_boron) Ground and excited state boron densities are now being calculated and output. The code compiles without errors.  I will begi
*   a6b561c Merge branch 'atomic_boron' of ssh://aero-mdgpu2.engin.umich.edu/home/brandon/.software/HPHall into atomic_boron
|\
| * 0c73784 Added variable MIN_YIELD during boron creation.  When the calculated sputter yield is less then MIN_YIELD, a Monte Carlo test is performed to d
* | 4808ed1 Saving my work on adding boron excitation and ionization.  I just realized that my MIN_YIELD changes that are vital to the stability of the cod
* | 14d2394 Added table lookups for ionization and excitation of boron to boron.c. I still have to write the functions that will call the lookup tables, as
* | 5e7a4af Changed struct type for boron atoms from neutral_type to boron_type, which includes a tag for the electronic state of the atoms. This will allo
|/
* 6fd8010 Forgot to initialize "boron_per_cell".  Added a line to allocate the memory for that variable.
* a83a6ce Added some lines to zero the boron fluxes during initialization.
* e205831 Oops.
* 0294ab6 Hack fix...  Moved check for being past cell boundaries to before the xi-eta integration.  This should at least give me some results for an IEPC
* e395310 Trying to debug by tracking where B atoms are created...
* f99923a (master) Fixed first set of bugs.  Am now dealing with seg faults due to boron atoms passing the right-hand side of the domain.  This may be rela
* 5b7c89b Have compiling code with boron.  Proceeding to testing and debugging.
* e8c1572 Yet another commit to save my work...
* eade77e Major additions to boron.c.  boron_create() is nearly finished; Only need to finish coding velocity components and addition of particles to boron
* 13a98fc Second commit on atomic_boron...  Just saving my work, nothing to see here.
* 49b2ef1 Initial commit on branch atomic_boron.

So, it looks like I was just being stupid. Nothing interesting to see here! Thanks for the help, Makoto!

  • What does `git log --graph --oneline --decorate` tell you while you're on the `atomic_boron` branch? – Makoto Feb 13 '15 at 19:10
  • Strange, it says that I'm on HEAD, atomic_boron, with hash b66c7bd. That's where I want to be, so I guess I was just doing something stupid. Thanks for the reply. I think I can mark this solved. – Brandon Smith Feb 13 '15 at 19:19
  • Mind pasting it into the question? I believe you (and a `git status` would confirm it), but I want to make sure that what you're seeing is the same thing that you're saying. – Makoto Feb 13 '15 at 19:20
  • Add a `--all` to that `git log ...` command to see all the commits, not just the ones reachable from where you're at. A repository visualizer like [GitX](https://rowanj.github.io/gitx/) or [gitk](http://www.git-scm.com/docs/gitk) will let you see the state of the repository even better. – Schwern Feb 13 '15 at 20:50

0 Answers0