X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;ds=sidebyside;f=pep-git.txt;h=a9b4d9ea3b37911fbdc6431541bc7a419946637c;hb=3464b8a43624f0a795e7a0b2908304cd4a661a70;hp=6a9f20b2371c9cb813d6268f946c2d9011012fda;hpb=a6d17ba08116f8da6ab854e3913c2ab10c9a7aea;p=git-wiki.git diff --git a/pep-git.txt b/pep-git.txt index 6a9f20b..a9b4d9e 100644 --- a/pep-git.txt +++ b/pep-git.txt @@ -85,6 +85,10 @@ MacOS X: use git installed with `XCode `_ or install git with `Homebrew `_: ``brew install git``. +`git-cola `_ is a sleek and +powerful Git GUI written in Python and GPL licensed. Linux, Windows, +MacOS X. + Initial configuration --------------------- @@ -379,6 +383,56 @@ https://kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.html Merge or rebase? ================ +Internet is full of heated discussions on the topic: "merge or +rebase?" Most of them are meaningless. When a DVCS is being used in a +big team with a big and complex project with many branches there is +simply no way to avoid merges. So the question diminished to "whether +to use rebase, and if yes - when to use rebase?" Considering that it +is very much recommended not to rebase published commits the question +diminished even further: "whether to use rebase on non-pushed +commits?" + +That small question is for the team to decide. The author of the PEP +recommends to use rebase when pulling, i.e. always do ``git pull +--rebase`` or even configure automatic setup of rebase for every new +branch:: + + $ git config branch.autosetuprebase true + +and configure rebase for existing branches:: + + $ git config branch.NAME.rebase true + +After that ``git pull origin v2`` will be equivalent to ``git pull +--rebase origin v2``. + +In case when merge is preferred it is recommended to create new +commits in a separate feature or topic branch while using rebase to +update the mainline branch. When the topic branch is ready merge it +into mainline. To avoid a tedious task of resolving conflicts you can +merge the topic branch to the mainline from time to time and switch +back to the topic branch to continue working on it. The entire +workflow would be something like:: + + $ git checkout -b issue-42 # create and switch to a new branch + ...edit/test/commit... + $ git checkout v2 + $ git pull --rebase origin v2 # update v2 from the upstream + $ git merge issue-42 + $ git branch -d issue-42 # delete the topic branch + $ git push origin v2 + +When the topic branch is deleted only the label is removed, commits +are stayed in the database, they are now merged into v2:: + + --o--o--o--o--o--o-M-