What Wikipedia Can't Tell You About Git Branches.

Git Branch-Tips To Learn:

Summary:
   create
   list
   rename
   delete
   
   

#git branch     
   It will display local repository branches laptop/desktop.
   we can create the branch
   we can delete the branch    
 
#git checkout -b chandrasekhar
   It will create the branch and switch the branch with single command.

   git checkout -b [branchname] 

#git branch -r    
   It will display remote repository branches available in git.
   
#git branch -a     
   It will display local&remote(all) repository branches.
 
#git branch dev
   It will create a new dev branch in your local repository.
 
#git cehckout
   switch from one brnach to another branch
   
#git checkout [branchname]
   #git checkout dev
   
#git commit -a -m
   It  will commit your changes to staging area without adding files.
   
#git diff dev
   It will compare difference between your given branch and whatever branch currently you are pointing to
   if you want to compare with 2 branches you have to specify 2 branch names.

   Example:
   #git diff dev test    
   Here dev and test are two different branches.

#git merge dev
   whatever the code in dev branch is going to integrate with currently pointing branch.

   #git merge [branchname]
   once integration done check diff if you want.
   
   Note:
   without committing changes, do not switch the branches.
    

 
#git push origin --all
   It is going to commit all local repo to remote repository.
 
And assume there are several branches are there, & you want to commit all branches changes to git remote repository then use this command.
 


Chandra Sekhar

A Blogger and Author! This post was written and edited by me, a technologist. I started this site to share my inspirations, work, and free materials, which I hope others may find useful as well. Man with a creative streak who enjoys experimenting with various web design strategies.

Previous Post Next Post

Microservice Communication in a Distributed System