git-diff

How to find out what files were changed in a git branch (not the difference between two branches)

…衆ロ難τιáo~ 提交于 2019-12-06 08:26:05
I have a branch named feature_219 which was created from master a little while ago. Since the diversion, there were a number of files changed on both the branches. Now I am trying to figure out what files where changed while working on the feature_219 branch only. After doing some research I found out that git diff --name-only master feature_219 might help but it turned out that this commands tells about all files that are different in both the branches. I tried to look for some option with this command but nothing worked for me. Is there any way to list only those files that were changed in

How to apply diff between commits to current head in git?

梦想与她 提交于 2019-12-06 06:03:43
问题 I was working on some topic branch on project I participate in. I normally rebase my branches before making a pull request. This time however, due to changes in master, rebasing is a big pain. Lot of conflicts and, what's worse, after manual merging commits look just ugly and loose their point. I would definitely prefer to obtain diff between my branch's head and latest commit present on both branches, then apply this diff to master's head and finally create brand new shiny commits with git

How to automatically use git diff --word-diff option for *.tex files but not others?

五迷三道 提交于 2019-12-06 05:54:40
问题 Is there a way to use --word-diff for LaTeX files (*.tex) and keep the standard line difference for other file types? What I want to achieve is to use git diff command and let git show the word difference on *.tex files automatically without a need to write git diff --word-diff each time. At the same time I want git to show the standard line difference for other file types. Is that possible? 回答1: See the Generating diff text section of the gitattributes documentation. However, to

how can I see the differences in a designated file between a local branch and a remote branch?

瘦欲@ 提交于 2019-12-06 05:03:44
问题 How can I see the differences in a designated file between a local branch and a remote branch? I know this command: git diff <local branch> <remote-tracking branch> But it gives the differences in all files between two branches while I only care about changes of one single designated file. 回答1: Take a look at git diff --help , which shows you: git diff [options] <commit> <commit> [--] [<path>...] So, you're almost there. Instead of: git diff <local branch> <remote-tracking branch> You can use

Git diff fails on file with underscore in path

╄→гoц情女王★ 提交于 2019-12-06 03:30:44
I'm running Windows 7, and I have the latest version of git (2.7.2.windows.1). I previously used Windows PowerShell as my terminal for git operations, with no issues. Recently, I decided to switch to Git Bash, but I'm having one major issue. My project has a directory (within which are many subdirectories) whose name is simply an underscore. Whenever I try to run git diff on a file within that directory, I get the following error: $ git diff _/css/templates/jquery.tag-editor.css fatal: Invalid object name '_C'. As far as I know, an underscore is a perfectly valid character in a file/directory

How to have git-diff ignore all whitespace-change but leading one?

做~自己de王妃 提交于 2019-12-06 02:06:31
问题 In another post I found the very neat git diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+' which does a great job at compressing git-diff 's output to the essential while remaining legible (especially when adding --word-diff=plain for additional [- / -] and {+ / +} surrounding deletions/additions). While this does include whitespace changes, the output does not highlight them in any noticeable way, e.g. when changing the indentation of a line of python code (which is a severe

How revision control system restores revision?

别等时光非礼了梦想. 提交于 2019-12-06 01:58:18
问题 My question is more general than declared in title. I know that source version control stores information only about differences. As I understand so does Wikipedia, and so does github. But they all have ability to show whole file with particular revision. Do they incrementally restore it from first revision to specific one? And another one question. If they store differences only, how they show them in ui with context (little bit text before and after changes). EDIT: github stores whole

How to resolve ambiguity between branch name and commit hash in git?

廉价感情. 提交于 2019-12-05 20:37:15
问题 I have a branch named 0726b and I want to diff my current working copy with that branch. Apparently there is also a commit that has a hash starting with that very sequence, because I get $ git diff 0726b warning: refname '0726b' is ambiguous. How do I tell git that it should take the argument as a branch name? 回答1: Try this: git diff refs/heads/0726b refs/heads/0726b specifies a branch named 0726b . The file ./git/refs/heads/0726b contains the commit hash that this branch points to. 来源: https

Colored, side by side, inline git diff output in my terminal

不问归期 提交于 2019-12-05 18:44:01
Please note this question is not a duplicate of, but a followup to the question "How can I get a side-by-side diff when I do “git diff”?" . This question seeks new information and the solution to a problem. Also, please note that I am seeking only solutions whose output is inline in the terminal like the default git diff is -- I don't want anything which opens an external gui diff program. Progress so far I have followed the suggestion from the SO question linked above and put the following executable on my path: #!/bin/bash # side-by-side diff with custom options: sdiff -w200 -l "$2" "$5" I

View full file diff of `x` commits of a single file's history (that's hosted in git)

时光总嘲笑我的痴心妄想 提交于 2019-12-05 13:54:42
Say I have a file in git called filex.code , and I want to see the full code of the last x versions of that file with each changed section highlighted -- all in one place. So an x -paned commit history of filex.code , almost as if I were doing an x -paned diff, but viewing historical versions rather than merging from different branches. The greater x , the better. Crossplatform would be great, but any of the Big Three works. Being able to edit the latest version would also be great, but read-only visualization is plenty. Note that this is different from a simple history of commits to a file,