Posting my most used Git commands here for easy reference.

Credential Configuration

// save configuration
git config --global credential.helper wincred

// clear confirguation
git config --global --unset credential.helper  

Common Everyday Commands

// list all branches in your repository
git banch  
// checkout an existing branch
git checkout [branch-name]  
// create and checkout a new branch
git checkout -b [new-branch-name]  
// publish a branch to origin
git push -u origin [new-branch-name]  
// add files to index
git add *  
// delete a branch
git push origin --delete [branch-name]  
// commit changes
git commit -m "new commit message"  
// push changes to origin
git push  
// pull changes from origin
git pull  
// stash changes for later/or just to abandon them
git stash  
// recover stashed changes
git stash apply  
// check for file changes on the current branch
git status  

Revert Commit

// note: all previous commits will be lost
git reset --hard [commit-hash-to-roll-back-to]  
git push --force  

Cleaning Broken Branches

git gc --prune=now  

Listing Commits

// list commits grouped by user
git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n  

Tagging

// list tags
git tag

// show details of tag
git show [tag]

// tagging
git tag -a [tag] -m "tag message"

// checkout tag and create a branch
git checkout tags/[tag_name] -b [branch_name]  

Hopefully you may find some of these useful too ;-)

If you're a .NET software developer and you're new to using Git, check out an older blog post here:

-SW