git-diff

Git Directory Diff does not work in my submodule

拜拜、爱过 提交于 2019-12-05 11:57:08
I am using Git 1.8.4 and Linux (Kubuntu 13.10). I have a Git repository with submodules. If I ask for directory diff in the main Git module, it works fine. If I do the same in one of the submodules, I get an error: ~/Projects/MAINMODULE/platform/SUBMODULE [master]$ git difftool -tool=meld --dir-diff --cached fatal: Could not switch to '../../../../platform/': No such file or directory diff --raw --no-abbrev -z --cached: command returned error: 128 ~/Projects/MAINMODULE/platform/SUBMODULE [master]$ cd .. ~/Projects/MAINMODULE/platform [master]$ cd .. ~/Projects/MAINMODULE [master]$ git difftool

How can I make `git diff` as fine-grained as StackExchange diff?

江枫思渺然 提交于 2019-12-05 07:46:46
问题 Is there a diff tool which can highlight single character edits as such, and not just show the old and new version of the whole line (i.e. the kind of diff StackExchange shows you for edits to a post)? I'd prefer one I could use on the Linux command line as diff in git . 回答1: You can try, from git diff: git diff --color-word=. Which is equivalent to --word-diff=color plus (if a regex was specified) --word-diff-regex=<regex> . That would transform this git diff : into this one: Images are from

Can I make git add -p show changes like git diff --word-diff?

天涯浪子 提交于 2019-12-05 03:48:15
I have recursively replaced many single word patterns in my code base. Before committing I need to check each for false replacements. It would help me a lot to have git add -p use the format of what --word-diff uses with git diff , where only the changed words are marked and not the entire line. Someone has asked the same here, but maybe it was implemented since? https://groups.google.com/forum/#!topic/git-users/7uO2OUJGvP0 Since Git 2.9, you can use the property interactive.diffFilter (as I mentioned below this answer ) But, any git -c interactive.diffFilter="git diff --color-words" add -p

How to make git log show file paths relative to current directory?

笑着哭i 提交于 2019-12-05 01:43:07
问题 The current Git-based project that I am working on, I am generally always in a sub-directory. Below is the output when I run the command git log --name-only from a sub-directory of the root of the repository. commit 678bd5ba6fc5474c4c61406768bf6cba5937c5d1 Author: thegreendroid Date: Mon Mar 27 09:36:24 2017 +1300 Commit message child_dir1_from_root/file1 | 184 +-- child_dir2_from_root/file2 | 2 +- How do I instead get git log to output something like below instead? This makes diffing the

git diff on a bare repo

拜拜、爱过 提交于 2019-12-05 01:20:00
问题 I wanna see how much a repo changed in the last month on gitlab server side cd /path/to/my/bare/repo.git/ git --git-dir . diff --shortstat "@{1 month ago}" fatal: Unable to read log 'logs/refs/heads/master': No such file or directory However it works fine in local checkout-ed working branch. Is there a way to do this without too much hassle? To avoid X-Y problem: I wanna run statistics through hundreds of repos on a Gitlab server 回答1: Try and make sure, when diff'ing in a bare repo, to

Why does `git diff` not work with process substitution?

℡╲_俬逩灬. 提交于 2019-12-05 00:59:08
Why does git diff not work with process substitution? $ echo hallo > hallo $ echo holla > holla $ git diff hallo holla # works $ git diff hallo <(cat holla) # works not diff --git a/hallo b/hallo deleted file mode 100644 index 4cf5aa5..0000000 --- a/hallo +++ /dev/null @@ -1 +0,0 @@ -hallo diff --git a/dev/fd/63 b/dev/fd/63 new file mode 120000 index 0000000..864a6ca` Same with git diff --no-index . It works with plain diff . cat is only a trivial example, can be replaced by a non-trivial sed expression. Workaround: $ cat holla | git diff hallo - # works But it will not work if both arguments

gitpython and git diff

左心房为你撑大大i 提交于 2019-12-05 00:53:12
I am looking to get only the diff of a file changed from a git repo. Right now, I am using gitpython to actually get the commit objects and the files of git changes, but I want to do a dependency analysis on only the parts of the file changed. Is there any way to get the git diff from git python? Or am I going to have to compare each of the files by reading line by line? You can use GitPython with the git command "diff", just need to use the "tree" object of each commit or the branch for that you want to see the diffs, for example: repo = Repo('/git/repository') t = repo.head.commit.tree repo

Limit Git Diff to one or more functions?

浪尽此生 提交于 2019-12-05 00:40:54
I set *.py diff=python in .git/info/attributes . So Git knows where function boundaries. git diff -W can even make sure the whole function is shown. But is there a way to limit the output of a git diff to just a particular function (or more than one)? (Failing that, I guess it's awk...) EDIT This would also be useful for git log and git rev-list : don't show me every commit that modifies views.py, show me commits that modify a certain function in it. (Yes, in an ideal world, views.py wouldn't be a 2000 line behemoth frequently modified by 8 different developers...) Steve Bennett Ok, thanks to

Exclude a single commit from a “git diff”

丶灬走出姿态 提交于 2019-12-04 23:46:19
Morning all, Let's say I have a series of commits as follows: abc000 def111 abc222 def333 abc444 def555 I know I can use $ git diff -c --binary abc000..def555 > /tmp/abc000_def555.patch to produce a patch to upgrade a system from abc000 to def555. But what if I wanted to (for reasons to dull to get into) exclude def333 from the patch - how can I do this? Note that I do not want to revert def333, its just that I do not want the patch to incorporate this commit. Thanks Actually all git diff s are commit-pair-wise: the above compares the trees/files in abc000 against those in def555 . If for

How do I prettily print out a git-diff output?

蹲街弑〆低调 提交于 2019-12-04 23:42:17
for my upcoming Bachelor thesis, I am required to print out the git-diff output for the appendix of the paper. I really like the output of git diff --color-words , but I have absolutely no idea how to bring this - colored and with line numbers included - to a piece of paper on my Mac. I know there are tools like SourceTree , but even with those I seem not able to make a pretty print out of the single file's diffs. Well, I am pretty sure that I cannot be the only one with this problem, and I found some suggested ansi2html solutions, but they to not seem to work with my version of git (1.7.10.2)