We’ve recently migrated from TFS to git. I’m an svn girl at heart, so it’s all a bit new and strange.
So far, it’s been a big learning curve. The Git – SVN Crash Course has been really useful. Things I have learned today:
git rebase
git reset
git reflog
is your friendWe’re still not sure how it happened, but my local branch went missing. Thanks to @ciaran_j I did a git reflog
and in there I found my commit logs! I was able to check out to the specified hash and then do a merge. Phew.
Disaster averted.
From what I’ve seen, git rebase is *usually* wrapped up in the calls you make elsewhere, so (if I remember rightly) things like git pull does a fetch of updates, and then rebases the local repo – in other words, applies all your unmerged diffs against the stuff you pulled from the shared repo.
git reset is like checking out a specific version point, usually seems like it’s used to checkout the last checked in version.
Of course, I might be wrong, I’m still a novice in this game too!
I’d ammend that myself to;
Commit often, commit early, and definitely *DO* play with stuff you don’t understand.
As long as you’ve committed you’ll be able to fix 90% of the things you can do with Git. There are of course exceptions, if you’ve wandered into the .git sub-folder, or you’re using one of the more raw commands, then yes you can cause problems.
But the only way to learn git is to make the mistakes and figure your way out of them 😉 .. personally I found it quite a brutal learning curve, but worth it 🙂