0

Git status:

Local:    master ~/Dropbox/MyProject/
Remote:   master @ origin (https://github.com/.../MyProject.git)
Head:     fe73b07 updated gitignore

Pending commits:
* updated gitignore
* test
* trying to go with a flat structure
* * testing.py:

This is how my short history looks like

fe73b07 * [HEAD] [origin/master] [origin/flat] [new] [master] [flat] updated gitignore
974e70d * test
ab333e6 * trying to go with a flat structure
b901d75 * * testing.py:

I feel so screwed; I just want to go back to b901d75 and forget everything else happened.

But whenever I check it out (checkout), I'm not allowed to commit/push with this.

After the git hard reset, I'm in this situation:

Local:    master ~/Dropbox/MyProject/
Remote:   master @ origin (https://github.com/../MyProject.git)
Head:     dec79d3 updated gitignore

Pending commits:
* updated gitignore
* test
* trying to go with a flat structure
* * testing.py:

Unpulled commits:
fe73b07 updated gitignore
974e70d test
ab333e6 trying to go with a flat structure

Unpushed commits:
dec79d3 updated gitignore
PascalVKooten
  • 20,643
  • 17
  • 103
  • 160
  • Magit may be able to do this, I don't know, but meanwhile just do it from the command line, with `git reset --hard b901d75` or the equivalent. –  Feb 20 '15 at 10:27
  • That just puts me at that branch, how can I now continue from here? – PascalVKooten Feb 20 '15 at 10:29
  • 2
    It doesn't "put you at that branch". It resets your branch to have that commit as its head. Now just keep working. –  Feb 20 '15 at 10:30
  • I tried to make a new useful commit (updated gitignore) but then it says "hint: Updates were rejected because the tip of your current branch is behind" – PascalVKooten Feb 20 '15 at 10:30
  • 3
    You can either delete the branch from wherever you are trying to push it to (something like `git push origin :branch`, note the colon!), and then push anew, or use `git push --force` (with all the usual caveats). –  Feb 20 '15 at 10:32
  • The force allowed doing it, but still those "pending commits" are shown... – PascalVKooten Feb 20 '15 at 10:33
  • I don't understand exactly what magit means by pending commits, it's a magit concept, not a git one. I assume they will go away if you restart emacs. –  Feb 20 '15 at 10:43
  • @torazaburo Unfortunately they don't, but I was somehow able to resolve it. Thanks! – PascalVKooten Feb 20 '15 at 10:51
  • It seems that the command `r s` might get rid of the "pending commits", haven't checked. –  Feb 20 '15 at 18:36
  • You should close this question, as it is basically the same as your https://stackoverflow.com/questions/28624782/… asked two hours earlier, but here you have already started to do the wrong thing, so it's much harder to answer. – tarsius Mar 05 '15 at 15:43

0 Answers0