I've seen people doing
git merge
i.e. using "git merge" with no arguments. It looks like it might do something useful. But I couldn't find documentation for this scenario on git-scm.com.
What does "git merge" do in this scenario?
Without any arguments, git merge will merge the corresponding remote tracking branch to the local working branch.
Merging is Git's way of putting a forked history back together again. The git merge command lets you take the independent lines of development created by git branch and integrate them into a single branch.
The Git merge --no-ff command merges the specified branch into the command in the current branch and ensures performing a merge commit even when it is a fast-forward merge. It helps in record-keeping of all performed merge commands in the concerning git repo.
Usually it does not matter if both branches are topic or feature branches. However, if you have an integration branch or a branch that marks what's been published, you definitely want to use the long lived integration branch as the one that's checked out and merge the other one into it.
It would try and merge its upstream branch (git merge
)
If no commit is given from the command line, merge the remote-tracking branches that the current branch is configured to use as its upstream.
So check, to see if a branch has an upstream repo associated to it:
git config remote.$(git config branch.$(git symbolic-ref --short HEAD).remote).url
This uses:
For Windows, crashneb suggests in the comments:
for /f %b in ('git symbolic-ref --short HEAD') do \
@(for /f %r in ('git config branch.%b.remote') do \
@(git config remote.%r.url))
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