Git Merge your next Change

Sometimes when you want to merge changes made in another branch (in some remote) to your master branch. (or any branch supposed to be working)

When you trust and it works fine for sure, then it would be quite simple:

git merge  

And also we can use buttons on Github. But that’s kinda.. I wanted to make it “clear” manually. Again, when you trust this remote branch for sure:

git checkout master  
# go to your local master to begin  

git pull  
# make sure if anything in it up-to-date with remote master  

git pull origin feature_branch  
# and merge the branch you need from remote  

git push  
# and update remote master with your change  

git push origin :feature_branch  
# and remove the remote and..  

git branch -d feature_branch  
# local branch you don't need any longer  

but when you don’t trust, it’s not that you don’t trust but just in case you better test it before merge, as like in cases You got a pull request:

git fetch origin  
# bring it in from your project repository  

git checkout -b feature_branch origin/feature_branch  
# set up to track the remote branch from your local. "Just in case."  

git merge master  
# merge your safe master to this stranger for review  

and test.. solve conflict.. edit file and see if it’s really working. And you’re determined to merge.

git checkout master  
# go back to your local master  

git merge --no-ff feature_branch  
# you merge only current commit of feature_branch  

You know, they said it’s better here on git workflow.

git push origin master  

This is what I didn’t know but I googled. Hope it helps!

 
0
Kudos
 
0
Kudos

Now read this

I wrote merge sort in Ruby

I am learning sorting algorithms these days. And to me merge sort looks simple than other sorts. (There are merge sort, insertion sort, quick sort, selection sort, bubble sort, et cetera.) I thought I should try to write it in Ruby. The... Continue →