Ok let's say we have a main branch called MAIN.
Let's say I create a local branch called 100.
Later on, someone creates a local branch on their own machine called 101.
Later on, they make changes to their local 101 branch, and then merge the changes back into MAIN.
Later on, I decide I'm finally ready to make some changes on 100.
However, I know MAIN has since changed. I want to make a one line git statement to update my local 100 branch with what's in MAIN.
Is there one?
Typically, I would do the following series of steps
git checkout MAIN
git pull
git checkout 100
git merge MAIN
How can I combine these series of steps into 1 command to pull the MAIN's branch into my local 100 branch (that contains no changes at the moment)?
You can reduce the number of commands, but there are a series of distinct steps that you cannot skip, and which make no sense to combine:
Git provides no magic single method for doing these three distinct and unrelated operations. The closest you're going to get is to either write your own higher-level command, or just do the three commands in one lin:
git checkout 100 && git fetch && git merge origin/MAIN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With