Get "git checkout tag" to produce the same output as "git pull" diff list -


i wondering if there's sort of tag or parameter can provide a

git checkout tags/{tag_name} 

call provide output similar regular git pull. i'm looking single command diff of current revision against code provided in new tag.

i'm sure can create bash script in 2 steps, wondering if there way part of git it.

if not, would advice diff (before or after doing checkout)? if cannot in 1 line git, will writing own script this.

the output follows git pull default output git merge, since pull fetch, followed merge. here's example:

$ git pull origin master c:/users/keoki/documents/github/bare  * branch            master     -> fetch_head merge made 'recursive' strategy.  hello.txt | 1 +  1 file changed, 1 insertion(+)  create mode 100644 hello.txt  $ git reset --hard head^ head @ 53c0907 revert "change `git diff` meta color cyan (os x)"  $ git merge origin/master merge made 'recursive' strategy.  hello.txt | 1 +  1 file changed, 1 insertion(+)  create mode 100644 hello.txt 

so see above, output, known "diff stat", part of normal mege in git.

getting diff stat output

there no options diff stat output with git checkout. you can, however, same output using git diff --stat.

to stat before switching branch, tag, or commit x branch, tag, or commit y, use

git diff --stat x y 

you can before or after checking y out, since git diff in case isn't diffing in current working copy.

documentation

according official git-merge(1) manual page, configuration variable merge.stat controls

whether print diffstat between orig_head , merge result @ end of merge. true default.

see also


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -