What is there in Git 2.8? Push, grep, rebase, config, and more
- Transfer
New Git 2.8.0 released ! Over the past couple of weeks, when the release was in the candidate stage, I went through the list of commits and notes for it, trying new things and noting interesting points. To save your time, I suggest a subjective selection of features that are worth a try. Use it!
Short version push -d
, synonympush --delete
This is a great addition to both the completeness of many options and the speed of typing. Perhaps you are already using git branch -d
to delete the local branch, but now you can also shorten the remote branch removal command to git push -d
.
git branch -d my-branch # удаляет локальную ветку, если она уже слита
git push -d origin my-branch # удаляет remote-ветку в origin-репозитории
Flow control and recursion protection for git grep
A couple of relevant features have been integrated into the functionality git grep
:
- Now you can specify how many threads
grep
should use to search the tree of objects. Add--num-threads
to the command or specify the parametergrep.threads
in.gitconfig
to make the setting permanent.git grep --num-threads=5
- If you run
git grep
in a folder that does not belong to the git repository, Git will start searching for the root of the repository, recursively checking the parent folder - this does not always correspond to what we would like to get as a result. With the new version, it became possible to use itgit grep
outside the git repository by explicitly specifying an option--no-index
. To make this behavior standard, just add a parametergrep.fallbackToNoIndex
to your Git configuration.git grep --no-index
Interactive mode pull --rebase
The command git pull --rebase
can now be run interactively:
git pull --rebase=interactive
This is an interesting addition to the pull rebase process when you want to collapse commits or change their comments directly during the pull run (don't forget about the standard warnings about using rebase ).
Ask u git config
;)
Now it git config
can show where the value was set: whether it is defined in the configuration file or blob-file, read from standard input or specified on the command line. For example, I may ask: "Where did I define my alias st
(status)?" , - and git config
tell me the answer:
git config --show-origin alias.st
file:/Users/np/.gitconfig status -s
Other interesting things
- An indicator of progress is pleasing to the eye, if it
git blame
takes a lot of time. - A new view notation has become available . It allows you to refer to a commit, reachable from a branch , but not satisfying a given pattern .
^{/!- } - You can configure the command
git fetch
to use only IPv4 (or IPv6) protocol when it is executed. Add a parameter:git fetch -4
orgit fetch -6
, respectively. - The view command did not work properly - this bug has been fixed.
git worktree add -B
What's next?
The above is just a selection, the release contains much more! More details about other innovations included in Git 2.8.0 can be found in the source code and full release notes .
Nicola Paolucci - Developer Advocate at Atlassian. He writes and talks about git, development processes, code collaboration, Docker. Before Atlassian, he led development teams, built crowd sourcing applications for geospatial data, and worked on the deployment of large e-commerce systems. Some facts about Nicola: he actively gestures when he speaks (being Italian), lives in Amsterdam and drives to Ducati. Nicola can be found on Twitter under the pseudonym @durdn .