X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;ds=sidebyside;f=pep-103.txt;h=f9388f7017880049fcde014dbafa25fa8e3f3291;hb=f35791b0e8a1500c9cab2a7f1fb5c5c1b9633f16;hp=07831041b88393f091a25f68abfbba7372f3c348;hpb=fc844705b7c145d77a60baea7210c26f06cae76a;p=git-wiki.git diff --git a/pep-103.txt b/pep-103.txt index 0783104..f9388f7 100644 --- a/pep-103.txt +++ b/pep-103.txt @@ -714,6 +714,25 @@ command. For example:: $ git check-attr -a -- \*.py +Useful assets +------------- + +`GitAlias `_ (`repository +`_) is a big collection of +aliases. A careful selection of aliases for frequently used commands +could save you a lot of keystrokes! + +`GitIgnore `_ and +https://github.com/github/gitignore are collections of ``.gitignore`` +files for all kinds of IDEs and programming languages. Python +included! + +`pre-commit `_ (`repositories +`_) is a framework for managing and +maintaining multi-language pre-commit hooks. The framework is written +in Python and has a lot of plugins for many programming languages. + + Advanced topics =============== @@ -753,8 +772,36 @@ See `WhatIsTheIndex Wiki. +Root +---- + +Git switches to the root (top-level directory of the project where +``.git`` subdirectory exists) before running any command. Git +remembers though the directory that was current before the switch. +Some programs take into account the current directory. E.g., ``git +status`` shows file paths of changed and unknown files relative to the +current directory; ``git grep`` searches below the current directory; +``git apply`` applies only those hunks from the patch that touch files +below the current directory. + +But most commands run from the root and ignore the current directory. +Imagine, for example, that you have two work trees, one for the branch +``v1`` and the other for ``master``. If you want to merge ``v1`` from +a subdirectory inside the second work tree you must write commands as +if you're in the top-level dir. Let take two work trees, +``project-v1`` and ``project``, for example:: + + $ cd project/subdirectory + $ git fetch ../project-v1 v1:v1 + $ git merge v1 + +Please note the path in ``git fetch ../project-v1 v1:v1`` is +``../project-v1`` and not ``../../project-v1`` despite the fact that +we run the commands from a subdirectory, not from the root. + + ReReRe -====== +------ Rerere is a mechanism that helps to resolve repeated merge conflicts. The most frequent source of recurring merge conflicts are topic @@ -783,7 +830,7 @@ Book. Database maintenance -==================== +-------------------- Git object database and other files/directories under ``.git`` require periodic maintenance and cleanup. For example, commit editing left