X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=pep-git.txt;h=2b55d6341cc55f7a9ceb87e9010ef0d680d97c18;hb=5951ed5068761231f74d262aaa9a8a290a3fae99;hp=165726390477547ca5eab0f60be8c058b9327935;hpb=9fe81e131a3956316741c83933130f3c6bddec76;p=git-wiki.git diff --git a/pep-git.txt b/pep-git.txt index 1657263..2b55d63 100644 --- a/pep-git.txt +++ b/pep-git.txt @@ -89,6 +89,9 @@ install git with `Homebrew `_: ``brew install git``. powerful Git GUI written in Python and GPL licensed. Linux, Windows, MacOS X. +`TortoiseGit `_ is a Windows Shell Interface +to Git based on TortoiseSVN; open source. + Initial configuration --------------------- @@ -383,6 +386,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-