Why Git Cherry-Pick Will Make You Question Everything.

Git Commands:

Summary:
git cherry-pick
git clone 
git fetch
git pull


#git cherry-pick
   once you create a repo it's going to create a branch also.
   default branch is master
   and we created another branch called csrdev.
   as a developer he committed n number times to csrdev branch like
   commit1,
   commit2,
   commit3 ... commitn etc.
   
   Now i want to integrate some portion of the code from csrdev branch to master branch
   or one branch to another?
   
   if we use git merge all the commits from csrdev is going to integrate with master.
 
   but i want to integrate only some portion of code for that
 
#git cherry-pick [commitid]
     create a branch test
     create a file using #touch chandra.txt
     edit chandra.txt using #vi chandra.txt
     it will open terminal window then press i & enter some data then press esc, :,wq orderly manner
     commit & take/copy the commit id.
    
     switch to other branch
     git cherry-pick [copied commit id pass here]
    
#git clone [repo url]
   if we want to take entire repository to your local computer we use this command.
   
   git clone https://github.com/chandra4u49/git-clone.git 

After Cloning: Follow These Steps

Edit any file and commit to local repository -
   you have to push it to remote repository now -how ?
   
   while cloning it will create default alias name as origin & default branch is master.
   
   #git push origin master  
   
   when you try to push ur changes to remote it will ask username & password
   
   and we need to get the access from master -repository belongs to whom
   
   we will get email notification and accept it then only u can able to push your code to
   git remote
repository .
   
   u can go and check git remote repository for your changes
   
   files/file content in git remote
repository are different from local repository   
   you need to fetch using
   
#git fetch origin master -get the updated code to local repository

   
   git merge origin -it will get updated code from remote
repository to
   working area/working Copy.
   
#git pull origin master
   
   git pull=git fetch +git merge origin/master  
   
 
 
For more updates follow,

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