Saturday, April 9, 2016

Learn Git_Project_Recipe Book

1.Go into the veggie-favorites remote
$ cd veggie-favorites/
2.Once inside veggie-favorites make a change to chili.txt and/or squash-lasagna.txt in the code editor.
Click Save, add your changes to the Git staging area, and then make a commit.
$ git add chili.txt                            
$ git add squash-lasagna.txt                   
$ git commit -m "Fisrt commit"                 
[master bd5d061] Fisrt commit                  
 2 files changed, 2 insertions(+)
3.Go into your clone
$ cd veggie-clone/
4.Fetch all new work from the remote.
$ git fetch                                                 
remote: Counting objects: 17, done.                         
remote: Compressing objects: 100% (13/13), done.                                                           
remote: Total 13 (delta 7), reused 0 (delta 0)              
Unpacking objects: 100% (13/13), done.                      
From /home/ccuser/workspace/recipe-book-a/veggie-favorites                                                 
 * [new branch]      master     -> origin/master
5. Merge origin/master into your local master branch .
$ git merge origin/master master                            
Updating 4681ee4..bd5d061                                   
Fast-forward                                                
 chili.txt          | 15 ++++++++-------                    
 margherita.txt     | 11 +++++++----                        
 squash-lasagna.txt |  4 +++-                               
 3 files changed, 18 insertions(+), 12 deletions(-)
6. Create a new branch, then switch over to it to work on new-recipe.txt. The recipe can be whatever dish you'd like.
$ git branch new-branch                                     
$ git checkout new-branch                                   
Switched to branch 'new-branch' 
7.Add your file changes to the staging area and make a commit.
$ git add new-recipe.txt                                    
$ git commit -m "newbranch commit"                          
[new-branch 56a4505] newbranch commit                       
 1 file changed, 1 insertion(+)       
8.Fetch one more time just for good measure (there won’t be a change).
$ git fetch 
9.Push your branch up to the remote.
$ git push origin new-branch                                
Counting objects: 5, done.                                  
Delta compression using up to 3 threads.                    
Compressing objects: 100% (2/2), done.                      
Writing objects: 100% (3/3), 259 bytes | 0 bytes/s, done.   
Total 3 (delta 1), reused 0 (delta 0)                       
To /home/ccuser/workspace/recipe-book-a/veggie-favorites    
 * [new branch]      new-branch -> new-branch
10.Navigate back to the remote,Confirm the presence of your new Git branch there.


                            








No comments :

Post a Comment