What is there in Git 2.8? Push, grep, rebase, config, and more

Original author: Nicola Paolucci
  • 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 -dto 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:


  1. Now you can specify how many threads grepshould use to search the tree of objects. Add --num-threadsto the command or specify the parameter grep.threadsin .gitconfigto make the setting permanent.
    git grep --num-threads=5 
  2. If you run git grepin 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 it git grepoutside the git repository by explicitly specifying an option --no-index. To make this behavior standard, just add a parameter grep.fallbackToNoIndexto your Git configuration.
    git grep --no-index 

Interactive mode pull --rebase


The command git pull --rebasecan 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 configcan 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 configtell 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 blametakes 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 fetchto use only IPv4 (or IPv6) protocol when it is executed. Add a parameter: git fetch -4or git 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 .


Also popular now: