Git teams you like / can't live without

Does anyone have git gems to add to each base install? Some cool commands you can't live without them add them to your .gitconfig [alias] 's

ps: saw some questions like this about other things, hope this is the best place

+4
source share
3 answers

This will give you la and lc , which shows you the oneline log, strictly ordered by 'author' or 'commit' date respectively. The "U" in the pretty specs refers to the "unix timestamp". The unix timestamp is included only for sorting and deletion later. Remains the ISO version.

 alias.la=! log () { git log --pretty=lau $1 | sort -rn | cut -d " " -f 2- | less ; } ; log alias.lc=! log () { git log --pretty=lcu $1 | sort -rn | cut -d " " -f 2- | less ; } ; log pretty.lau=format:%at %C(dim yellow)%h %C(cyan)%ai%Cgreen%d %Creset%s pretty.lcu=format:%ct %C(dim yellow)%h %C(cyan)%ci%Cgreen%d %Creset%s 

Using git la <commit specifiers> , so it could be git la or git la branch or git la C1..C2 . Note, however, that .. still operates in the usual way log . Sorting is post-processing only.

And here is another one:

 > cat ~/bin/git-advance #!/bin/bash C="`git log --first-parent --format=%H ..$1 -- | tail -1`" if [ -z "$C" ]; then echo "Could not determine next commit" exit 1 fi git checkout "$C" 

And then, of course, alias.advance=! git-advance alias.advance=! git-advance . Using git advance <future-commit> and will check the next commit from the current HEAD to the given <future-commit> . This will disconnect HEAD, but I find it convenient to transfer commits from git to another VCS manually. No guarantees, have not tried it on complex stories.

Here is something experimental for missing renames in merge conflicts:

https://gist.github.com/894374

+1
source

One of the ones I recently discovered that I really like is actually located in the dw git directory, so it’s easy to get: it is called git new-workdir

It allows you to create a second working directory for the repository without duplicating the entire repository. This allows you to work in two separate branches at the same time, which is very convenient for me.

+2
source

some of those that I received (from random sites, I don’t remember where)

for a pretty tree view of all commits:

 lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative 

get the last committer

 whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -" 

show last commit

 whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short 
+1
source

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


All Articles