Below you will find pages that utilize the taxonomy term “Git”
A Few Useful Git Commands
I’ve been working fulltime with Git for a while now and I’ve noticed a pattern of commands that emerge every so often, but not often enough that would make me remember them.
That’s why I decided to post them here so I know where to look in the future. And of course they can turn out to be useful to someone else too.
So without further ado, here they are:
#undo last commit
git reset HEAD^
#show files in a given commit
git show --pretty="format:" --name-only rev_number
#remove untracked files and directories
git clean -f -d
#track remote branch
git branch --track branch_name origin/master
# given you created a new local branch 'branch_name'
# pushes 'branch_name' to 'origin/branch_name', creating the remote branch for you
git push origin branch_name
#delete remote branch
git push origin :remote_branch_name
I’ll keep this list up to date and add more useful stuff as need arises. Enjoy.
git cheat shee
For those who don't know Git is a version control system developed by Linus Torvalds. It's main difference from other tools like SVN and CVS is the fact that it's distributed.
Recently I gave a workshop about Git here at the company where I walked through the most common cases I usually see when working in a team and thought about posting a summary of the commands used in the workshop.
It turns out that just this morning I found this - a.k.a the rest of my post. It's a really nice and concise Git Cheat Sheet that covers most of what I talked about in the workshop. So I highly recommend you bookmark it. It will certainly be useful.