Git command reference
Summary
Git is a very powerful source control system. There are some useful commands to try and memorise!
Commands
Configuration related
Get the location of the config files used for all the settings in git
Set your user info
Add a global proxy for your setup
Add a proxy for a given URL:
A sample of the above:
Submodule related
Generally speaking, avoid submodules and use nuget packages instead. But if you have to deal with them, when you pull a full repo, it is likely you will need to update all the submodules as well. This can be done with running from the repo root:
Undoing commits
Undo a commit to a local branch. Say you accidently push files to your local master instead of pushing to a branch for a PR, use this to undo the change:
This will undo the commit AND leave the changed files still changed so you can push them to the correct branch. But if you want to blow away the changes and revert to the previous commit just use:
But be really sure you want to do it as there is no undo.
Last updated