Sorry, I\'m a git newbie (though I\'m very familiar with older source control systems like cvs and svn) ...
My ultimate goal is to add a file to a remote repository (one
Git is a wonderful tool, but it's easy to get lost without a good map of where you are in the forrest of commits.
Here's how to get that map (I call it "gr" for "graph", but you could also call it "map" if you prefer):
git config --global alias.gr 'log --graph --full-history --all --color --decorate'
That's a one-time setup for git. Now whenever you're lost, just take a look at the map:
git gr
Your current location is denoted by the word "HEAD", and any branch names are also listed.
You'll see that you're currently not on any branch, which sounds a lot worse than it really is -- it's actually no big deal, it just means your commits won't go into the master branch the way you want them to.
So just get back on your master branch and commit there:
git checkout master
git add yourfile.txt
git commit -m'Narg'
git push
Also take a look at git gr
now and you'll see that HEAD is at the same commit as master, and master is at the same commit as origin/master, which means you're all set.