Is there a way to say this more concisely?
git checkout master
git merge branch
What I actually want to do much of the time is:
git rebase master branch
git checkout master
git merge branch
Answer https://stackoverflow.com/a/12343727/313842 sort of touched on this but leaves branch checkout out. git merge in one command is also a similar but different question.
Merging Branches in a Local RepositoryTo merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch.
New Branches The git branch command can be used to create a new branch. When you want to start a new feature, you create a new branch off main using git branch new_branch . Once created you can then use git checkout new_branch to switch to that branch.
If your branch names are generally long, and you constantly merge the branch you just checkout from, you can use:
checking out from branch you want to merge
git checkout branch
git merge -
the '-' is shorthand for the previous branch, very handy for quick checking out and merging
You have several options:
git alias
.gitconfig
fileUse & operator
git checkout master && git merge branch & ... & ...
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