📜 ⬆️ ⬇️

What's in git 2.8? Push, grep, rebase, config and other things

New Git 2.8.0 has been released ! During the last couple of weeks, when the release was in the candidate's stage, I walked through the list of commits and notes to it, trying new things and noting interesting points. To save your time, I propose a subjective selection of features worth trying. Use!


The short version of push -d , a synonym for push --delete


This is a great addition to both the completeness of the set of options and the speed of the instruction set. You may already be using git branch -d to remove the local branch, and 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 current features have been integrated into the git grep functionality:


  1. Now you can specify how many streams should grep use to search the object tree. Add --num-threads to the command or specify the grep.threads parameter in .gitconfig to make the setting permanent.
     git grep --num-threads=5 <pattern> 
  2. 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 receive as a result. With the new version, it became possible to use git grep outside the git repository, explicitly specifying the option --no-index . To make this behavior standard, just add the grep.fallbackToNoIndex parameter to the Git configuration.
     git grep --no-index <pattern> 

Interactive mode pull --rebase


The git pull --rebase can now be run interactively:


 git pull --rebase=interactive 

This is an interesting addition to the process of pull rebase, when you want to close commits or change their comments right at the time of the pull (do not forget about the standard warnings about the use of rebase ).


Ask git config ;)


Now git config can show where the value was set: whether it is defined in the configuration file or a blob file, read from standard input, or specified on the command line. For example, I can ask: "Where did I define my alias st (status)?" , - and git config will tell me the answer:


 git config --show-origin alias.st file:/Users/np/.gitconfig status -s 

Other interesting things



What's next?


The above is just a sample, the release contains much more! More information about other innovations included in Git 2.8.0 can be found in the source code and the full release notes .




Nicola Paolucci - Developer Advocate in 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 deploying large e-commerce systems. Some facts about Nicola: he is actively gesticulating when he speaks (as an Italian), lives in Amsterdam and goes to Ducati. Nicola can be found on Twitter under the pseudonym @durdn .


')

Source: https://habr.com/ru/post/281188/


All Articles