Reputation: 608
In this picture below from the Github(c) Desktop App there ist this button "Update from master" (in this case). I was wondering if anyone had the insight what exact git function it triggers. Primarily I'm interested if merge or rebase is used. (I could not find any sort of log console).
Upvotes: 27
Views: 29732
Reputation: 51
GitHub themselves say it's just git merge <defaultBranch>
.
To quote the official comments on the issue in the GitHub Desktop repo:
This menu item emits the
update-branch
message to the main window (what we call the renderer in Electron terminology). TheupdateBranch
method then looks for your default branch (typicallymaster
). Git operations in the app use the Git command line, so what we're doing in the app is just agit merge master
into your current branch.)
Upvotes: 2
Reputation: 4045
Just go into "Branch" menu, then "Merge into current branch..." and choose the branch you want to get your "update" from.
Upvotes: 4
Reputation: 13909
When I hover over the button, it explicitly says "Merge XX commits from "
Upvotes: 4
Reputation: 524
The git commands underlying the buttons in GitHub Desktop are not well-documented, so I investigated a while back. I concluded that the "Update from..." button dispatched
git merge --no-ff -m "Merge <auto_text> <branch_name>" <branch_name>
or something nearly identical with the "Compare" branch set to <branch_name>
in the GitHub Desktop GUI.
I reached the conclusion in the following way:
First, I forked a repository that I control to my GitHub account. Then, I cloned the repository from my GitHub account to my local machine. Next, I committed a small change to the (original) main remote repository. Finally, I used git fetch <remote_name_assigned_to_main_repo>
(<remote_name>
, hereafter) to bring the single commit to my local machine. After this fetch
, the "Update from..." button lit up.
This set up a scenario in which the branch checked out, master
in my local repository, was one commit behind master
in the main remote repository. By default, git merge <remote_name>
would have produced a fast-forward merge (without a merge commit).
Using the "Update from..." button, however, resulted in the following reflog
entry:
HEAD@{0}: merge <remote_name>/master: Merge made by the 'recursive' strategy.
And a merge commit in the log
:
Merge remote-tracking branch '<remote_name>/master'
(The 'recursive' strategy "...is the default merge strategy when pulling or merging one branch." per the manual.)
I also set up a scenario in which git rebase
might have been an option, but saw the same merge behavior.
Upvotes: 28