Cancellation of a bad load

First of all, Git sucks. I know, I know, it should be best after sliced ​​bread, but that sucks. This is like trying to shave off a chainsaw: one small mistake, and everywhere there is blood and teeth. Perhaps if I could accurately distinguish between head, reflection, fixation, branch, stem, gnargel and whizpoo, some of them might be a little easier, but as an ordinary mortal with 10 years experience SVN, Perforce and RCS, it all looks like rather capricious black magic.

Now for some reason git pull never worked for me. I get a 10-line error message, which so far has been as useful as the word "error." As a result of the error message, many suggestions appeared that had only the general fact that they had no effect. But this is not a problem today: I'm used to typing git pull origin branch .

Today I turned over between two branches: "master" and "living room", and at that moment I was in the master branch. I wanted to get the latest changes from the remote repository to the local one, but I was mistaken. Instead of writing git pull origin master I wrote git pull origin lounge , and then, without hesitation, I typed the correct command.

There are no signs of the first (bad) pull in the log, just two merges with the master:

 commit 0c6be9569bab0581244ea8603bf2edfee82cdd7b Merge: 43fdec5... db09f0d... Author: Malvolio <info@xcompanyx.com> Date: Wed Nov 24 20:38:58 2010 -0500 Merge branch 'master' of github.com:xcompanyx/xRepositoryX commit db09f0d79d744d6a354142041b47ff5d748999f3 Merge: 81b6c3d... fc73e25... Author: Malvolio <info@xcompanyx.com> Date: Wed Nov 24 17:38:16 2010 -0800 Merge branch 'master' of github.com:xcompanyx/xRepositoryX commit 81b6c3d04b7c464f8750a56282635526a5ef83a1 Author: Michael <info@xcompanyx.com> Date: Wed Nov 24 17:38:07 2010 -0800 the last commit I did 

But the files created in the lounge branch are in my repository.

So now I'm fscked, right? Should I just burn my repository, clone the remote computer again, reapply all the changed changes manually and write it before Git suck or is there some kind of spell that I can read and it all improves? Would it help me if I donated a goat?

+44
git
Nov 25 '10 at 2:05
source share
2 answers

Use git reflog to see what your HEAD pointed out before you screwed it.

You should see something like:

 48ab8d HEAD@{0}: pull: Fast-forward a34bda HEAD@{5}: commit: my last commit message 

Now, point your main branch back to commit before a failed push:

git reset --hard a34bda

Done. As if this did not happen.

+35
Nov 25 '10 at 4:39
source share
— -

I can’t fully understand your story from your question, but in general, if you do two merges (pulling is a merge), it’s quite simple to delete one of them.

 - o - o - o - A - M1 - M2 (master) / / - o - o - o / (origin/lounge) / - o - o (origin/master) 

The most obvious way:

  git checkout master git reset --hard A git merge origin/master 

It uses a local cached version of the original, if you want to combine everything that is there, use git pull origin master .

+6
Nov 25 '10 at 4:00
source share



All Articles