Git Cheatsheet

Create new branch and push to remote
$ git branch [branch name] -> create local branch
$ git push origin [branch name] -> push local branch to remote

pulling code from a remote branch and create a new local branch
$ git checkout -b [local branch name] [remote branch name]

delete remote branch
$ git push origin :[branch name]

list branch in remote repo
$ git branch -r

Switch to a master branch
$ git checkout master

merging code from other branch to master (–no-ff is to always create commit object to avoid losing
info about historical existence of another branch and groups together all commits
$ git merge –no-ff [other branch name]

delete local branch
$ git branch -d [branch name]

tag a commit for future reference (can be used for the purpose of versioning)
$ git tag -a [tag name] -m “[some description]”

To see how many commits created since the last tag or given tag
$ git describe –tags

push all tags to remote
$ git push –tags

push one tag to remote
$ git push origin [tag name]

list existing tags
$ git tag -l

checkout a tagged revision and create a branch
$ git checkout -b [branch name] tags/[tag name]

Update on 08th May 2o12

Delete Branch at Remote:
$ git push origin –delete [branch name]

To remove a tag on the remote server:
$ git push origin :refs/tags/[tag name]



Tagged: , , , , , , ,

5 thoughts on “Git Cheatsheet

  1. sandi February 3, 2012 at 7:05 am Reply


  2. seo services plan February 10, 2013 at 8:57 am Reply

    Does your blog have a contact page? I’m having a tough time locating it but, I’d like to shoot you an e-mail.

    I’ve got some recommendations for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it develop over time.

  3. April 17, 2013 at 11:02 pm Reply

    It’s a pity you don’t have a donate button! I’d certainly donate to this fantastic blog! I guess for now i’ll settle
    for book-marking and adding your RSS feed to my
    Google account. I look forward to fresh updates and will share this blog with my Facebook group.
    Chat soon!

  4. It’s remarkable for me to have a website, which is good designed for my experience. thanks admin

  5. July 26, 2013 at 2:00 am Reply

    Simply desire to say your article is as surprising.
    The clarity to your put up is just excellent and i could
    assume you’re an expert in this subject. Well along with your permission let me to clutch your feed to stay updated with approaching post. Thank you a million and please continue the enjoyable work.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: