B
, git merge A
(default), git merge --ff A
, git merge --ff-only A
Default when using
git pull
is fast-forward, otherwise
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint: git config pull.rebase false # merge
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.
B
, do git rebase A
git add
to select your modifications solving a conflict in the current commitgit rebase --continue
to proceed to the next commit.
git pull --rebase
uses git rebase origin/main
in our example.
B
, do git merge A
git add
to select your modificationgit commit
to create the merge commit.
git pull --no-rebase
uses git merge origin/main
in our example.
main
branch is always cleangit branch a_new_feature
and git push -u origin a_new_feature
git add
/git commit
/git push
as much as you wantgit rebase main
to update your branch with main
(and potentially deal with conflicts)git checkout main
and git merge a_new_feature
In practice, we use a Git plateform: GitHub, Gitlab, Bitbucket,...
main
branch is always cleangit branch a_new_feature
and git push -u origin a_new_feature
git add
/git commit
/git push
as much as you wantgit rebase -i
to clean your branch before merging. a fork is a copy of an existing repository in which, usually, someone else is the owner.
git branch a_new_feature
and git push -u origin a_new_feature
git add
/git commit
/git push
as much as you wantremote
corresponding to the upstream repositorygit scales ! from your article/proto code to Linux kernel and Windows