Undoing Things
git commit --amend
: when you commit too early and possibly forget to add some files$ git commit -m 'initial commit' $ git add forgotten_file $ git commit --amend
git reset HEAD <filename>
: unstaging a Staged File$ git add * $ git reset HEAD CONTRIBUTING.md
git checkout -- <filename>
, unmodifying a Modified File
Working with Remotes
git remote add <remote-name> <url>
: add a new remote Git repository as a shortname you can reference easily. (you can use the stringon the command line in lieu of the whole ) git remote rename <old-remote-name> <new-remote-name>
git fetch [remote-name]
: goes out to that remote project and pulls down all the data from that remote project that you don’t have yet.- only downloads the data to your local repository – it doesn’t automatically merge it with any of your work or modify what you’re currently working on.
git pull
: automatically fetch and then merge that remote branch into your current branch.git push [remote-name] [branch-name]
:git remote show [remote-name]