The vast majority of the projects I work with use Git as their source control. I predominantly use a Git UI tool for most of my daily Git interactions, however there’s times when I need to jump to the command line to have that extra control.
My Git client of choice is still Team Explorer built into Visual Studio. I realise there are more feature rich clients available but I like the simplicity of the Visual Studio integration and enjoy that it doesn’t get in my way. Fetching, Pulling, Branching, Merging are all easily achieved without needing to leave VS. For the times I need more control I jump down to the command line.
Top tip: Install Mads Kristensen’s Visual Studio extension Open Command Line to open the command line at the relevant path with the shortcut Alt+Space
Here are the basic commands I use almost daily.
Status of working changes
Add files to a commit
git add .
git add [filename]
git commit -m "This is my commit message"
Undo last local commit
git reset --soft HEAD~1
Stash working changes
git stash apply
git stash drop
git checkout [branch name]
Remove local references to old branches
git remote prune origin
Remove cached files after a gitignore update
git rm -r --cached .
git add .
git commit -m "Removed cached files after updating gitignore"