Skip to content
Aasim's Web Corner
Aasim's Web Corner

Ink is better than the best memory.

  • Odysseys & Artistry
    • Saunterer Soul
    • My Poetry
    • My Sketch Work
  • Project Management
    • Agile & Frameworks
    • PMP Certification
  • Digital Diary
    • History
    • Islam
    • Life Around Us
    • My Bookshelf
  • My Tutorials
    • Amazon Kindle
    • Android
    • Aspect Oriented Programming
    • BlackBerry
    • Code Repositories
    • iOS
    • Java
    • JavaScript
    • Linux
    • Random Tips
Connect with me
Aasim's Web Corner

Ink is better than the best memory.

Daily Git

Aasim Naseem, January 9, 2012 | Read Count: 13,484April 29, 2025
Category: My Tutorials > Code Repositories

Hi everyone;

So long its been when I last posted anything on my blog; The reason was again the same, some tight schedules and some other home activities; But Notw I’m back; Say welcome please; (:

Today’s post is simple; Now a days me and my team is using Git for our code management; So here are some git commands for daily usage; I’m not going to describing their usage in details; This post is for busy developer who just want to know the exact syntax of a command for a particular requirement;

So here we go …

updated on 10 jan, 2k12:
git-blame  Show what revision and author last modified each line of a file;
git branch –contains Only list branches which contain the specified commit;

updated on 21 Dec, 2k12:
Every command has its own set of options, which are used with hyphen sign; Like commit command has one option -m with is used to provide a commit message; In this post I’m not covering the options’s details in depth; This article is only for a quick reference;

Fetching code from a repository;
git clone git@IP-ADDRESS–OR–URL–OF–SERVER:example.git
This command will download all code from a particular git repository to your system; This is equivalence to SVN/CVS checkout;

git pull origin <branch name> Will fetch updated code from remote repository to your system; Its just like update in SVN/CVS;

Play with branches

git branch Will display all branches of your current repository
git branch dev Will create a new branch named dev, to current repository; Note that this branch is only to your local repository;
git checkout dev You will be switched to dev branch locally;
git checkout -f B2  Forcefully switch to B2, reverting all your changes of current working branch;

To commit your code
git status Will show all your changes for current working branch;

git add <file/directory name> Will add a file or directory in commit queue of git; This commit is only to your local repository; You can add one or more files/directories with this command;

Tip: If there are more then on file in a directory, then just use the directory name in add command and git add will all modified files to commit queue itself;

git add –u will removed deleted files from git status message; Sometimes many deleted files are shown in git status log, so this command will remove those deleted files form git’s logs;

git commit -m “message” Will commit the previously added files to current local repository;

git push origin dev will send your changes from local repository to remove git repository; This action is same as commit in svn; Now your code is actually submitting to remote server;

To merger code from B1 branch to B2 branch

Assuming that you have pushed all your local changes to remote B1 branch ;

git checkout B2 Will switch you from previous branch to B2 branch;
git merge B1 Will merge the code in B2, from B1; (The code of B1 will be merged in B2 and B1 will remain intact) Again note that this change will occur only to your local repository;
git push origin B2  Will push your code to remove B2 branch, from your local repository;

To Revert your changes in local repository

git checkout path/to/file/to/revert This will revert all the changes of a single file; It checksouts the current index for the current directory, throwing away all changes in files from the current directory downwards.

git reset –hard HEAD Will revert all of your changes in current working branch; The command is save as svn revert -R .

If you know any command of git for daily use, just dont’ hesitate to share with us;
Happy Development; (:

free counters

Author Profile

Aasim Naseem
Hey, Thanks for your interest. I’m a PMP, AWS Solutions Architect, and Scrum Master certified professional with 17+ years of hands-on experience leading projects, building teams, and helping organizations deliver software solutions better, faster, and smarter.

Outside of work, I’ve got a deep curiosity for history — especially ancient civilizations like Egypt. I also enjoy reflecting on the everyday moments that shape how we live and work. This blog is my space to share insights, lessons, and thoughts from both my professional journey and personal interests.

Thanks for reading — and I hope you will find something here that matches your interest.
Latest entries
  • Economic impact of Eid ul Adha - AasimNaseem.comIslamJune 6, 2025 | Read Count: 283Economic impact of Eid-ul-Adha
  • Best PMP Exam Study Resources - AasimNaseem.comPMP CertificationMay 23, 2025 | Read Count: 493Best PMP Study Resources for 2025 (Books, Courses, Tools & More)
  • agile vs scrum - AasimNaseem.comAgile & FrameworksMay 7, 2025 | Read Count: 463Agile vs Scrum: Finally Understanding the Difference
  • When Agile shouldn’t Use - AasimNaseem.comAgile & FrameworksApril 25, 2025 | Read Count: 494When Not To Use Agile: 5 Signs You Need a Different Approach
Code Repositories commit code in gitgitgit addgit branchgit checkoutgit clonegit commitgit mergegit pullgit pushgit resethow to revert single file git

Post navigation

Previous post
Next post

Related Posts

Code Repositories svn Files from Mac - AasimNaseem.com

How to delete .svn Files from Mac;

July 18, 2011 | Read Count: 14,490April 29, 2025

Category: My Tutorials > Code RepositoriesHere is a quick way to delete all .svn files from a particular directory and all its child directories: Open your terminal, navigate to the directory from where you want to delete .svn files; Author Profile Aasim Naseem Hey, Thanks for your interest. I’m a…

Read More
Code Repositories Guidelines for Using Code Repositories - AasimNaseem.com

Guidelines for Using Code Repositories

January 13, 2011 | Read Count: 14,484April 29, 2025

Category: My Tutorials > Code RepositoriesHello everyone; Hope you are doing good at your desks; Today im lil technical; Will talk about code repositories and their usages; This is an essential checklist for playing with code repositories; Everyone need to follow this; If I miss anything, or any point where you…

Read More

Comments (8)

  1. arslanali786 says:
    January 9, 2012 at 8:18 pm

    is there any GUI based client for git ? like svn has tortoise svn ? or only way to make commands using cmd ?

    Reply
    1. Ans says:
      January 10, 2012 at 11:33 am

      Thanks Arslan for find time to read the post and comment; Yes there are gui client available for Git; You can find TortoiseGit at http://en.wikipedia.org/wiki/TortoiseGit for windows and GitHub tool for mac at http://mac.github.com;

      Reply
  2. Athar says:
    January 9, 2012 at 8:34 pm

    welcome back, thanks for sharing the knowledge and making life bit easier

    Reply
  3. Athar says:
    January 9, 2012 at 8:37 pm

    welcome back, thanks for sharing the knowledge

    Reply
  4. gcbenison says:
    January 9, 2012 at 9:28 pm

    After learning the commands in your list, I would recommend next making friends with the following two:

    git branch –contains
    git blame

    They are very useful for finding your way in a repository.

    Reply
    1. Ans says:
      January 10, 2012 at 11:36 am

      Thanks; Loving this; I missed them I confess, but you made the post complete; Thanks again for your time dear;

      Reply
  5. Zeeshan Ahmad says:
    January 9, 2012 at 11:39 pm

    nice post. Loved the knowledge you shared,

    Reply
    1. Ans says:
      January 10, 2012 at 11:37 am

      Pleasure; I love your love man; (:

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Economic impact of Eid-ul-Adha
    Economic impact of Eid-ul-Adha
    June 6, 2025 | Read Count: 283
  • Best PMP Study Resources for 2025 (Books, Courses, Tools & More)
    Best PMP Study Resources for 2025 (Books, Courses, Tools & More)
    May 23, 2025 | Read Count: 493
  • Agile vs Scrum: Finally Understanding the Difference
    Agile vs Scrum: Finally Understanding the Difference
    May 7, 2025 | Read Count: 463
  • When Not To Use Agile: 5 Signs You Need a Different Approach
    When Not To Use Agile: 5 Signs You Need a Different Approach
    April 25, 2025 | Read Count: 494
  • Quran on Peace and Kindness
    Quran on Peace and Kindness
    April 20, 2025 | Read Count: 453

Posts from Past

  • June 2025
  • May 2025
  • April 2025
  • January 2025
  • November 2024
  • April 2024
  • October 2022
  • August 2021
  • September 2020
  • May 2020
  • April 2019
  • January 2019
  • September 2018
  • July 2015
  • June 2015
  • November 2014
  • September 2014
  • April 2014
  • June 2013
  • May 2013
  • February 2013
  • January 2013
  • December 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • March 2012
  • February 2012
  • January 2012
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009

Categories List

  • Agile & Frameworks
  • Amazon Kindle
  • Android
  • Aspect Oriented Programming
  • BlackBerry
  • Blog
  • Code Repositories
  • History
  • iOS
  • Islam
  • Java
  • JavaScript
  • Life Around Us
  • Linux
  • My Bookshelf
  • My Poetry
  • My Sketch Work
  • PMP Certification
  • Random Tips
  • Saunterer Soul

Recent Posts

  • Economic impact of Eid-ul-Adha
  • Best PMP Study Resources for 2025 (Books, Courses, Tools & More)
  • Agile vs Scrum: Finally Understanding the Difference
  • When Not To Use Agile: 5 Signs You Need a Different Approach
  • Quran on Peace and Kindness

Recent Comments

  1. Aasim Naseem on When Not To Use Agile: 5 Signs You Need a Different Approach
  2. Aasim Naseem on When Not To Use Agile: 5 Signs You Need a Different Approach
  3. Masjid Wazir Khan, Lahore Pakistan - Aasim's Web Corner on Everlasting Art of Badshahi Masjid Lahore Pakistan
  4. Rishi Kumar on When Not To Use Agile: 5 Signs You Need a Different Approach
  5. Best PMP Study Resources for 2025 (Books, Courses, Tools & More) - Aasim's Web Corner on PMP Exam Eligibility 2025: 3 Things You Need to Know
©2025 Aasim's Web Corner | WordPress Theme by SuperbThemes