git-diff

How to view file history in Git?

假如想象 提交于 2019-12-17 17:22:17
问题 With Subversion I could use TortoiseSVN to view the history/log of a file. How can I do this with Git? Just looking for history record for a particular file, and then the ability to compare the different versions. 回答1: Use git log to view the commit history. Each commit has an associated revision specifier that is a hash key (e.g. 14b8d0982044b0c49f7a855e396206ee65c0e787 and b410ad4619d296f9d37f0db3d0ff5b9066838b39 ). To view the difference between two different commits, use git diff with the

Show diff between commits

只愿长相守 提交于 2019-12-17 17:19:49
问题 I am using Git on Ubuntu 10.04 (Lucid Lynx). I have made some commits to my master. However, I want to get the difference between these commits. All of them are on my master branch. For example: commit dj374 made changes commit y4746 made changes commit k73ud made changes I want to get the difference between k73ud and dj374. However, when I did the following I couldn't see the changes I made in k73ud . git diff k73ud..dj374 > master.patch 回答1: Try git diff k73ud^..dj374 to make sure to

How to see the changes in a Git commit?

青春壹個敷衍的年華 提交于 2019-12-17 17:17:42
问题 When I do git diff COMMIT I see the changes between that commit and HEAD (as far as I know), but I would like to see the changes that were made by that single commit. I haven't found any obvious options on diff / log that will give me that output. 回答1: To see the diff for a particular COMMIT hash: git diff COMMIT~ COMMIT will show you the difference between that COMMIT 's ancestor and the COMMIT . See the man pages for git diff for details about the command and gitrevisions about the ~

git-diff to ignore ^M

允我心安 提交于 2019-12-17 01:19:06
问题 In a project where some of the files contains ^M as newline separators. Diffing these files are apparently impossible, since git-diff sees it as the entire file is just a single line. How does one diff with the previous version? Is there an option like "treat ^M as newline when diffing" ? prompt> git-diff "HEAD^" -- MyFile.as diff --git a/myproject/MyFile.as b/myproject/MyFile.as index be78321..a393ba3 100644 --- a/myproject/MyFile.cpp +++ b/myproject/MyFile.cpp @@ -1 +1 @@ -<U+FEFF>import

What are the differences between double-dot “..” and triple-dot “…” in Git diff commit ranges?

跟風遠走 提交于 2019-12-16 20:32:50
问题 What are the differences between the following commands?: git diff foo master # a git diff foo..master # b git diff foo...master # c The diff manual talks about it: Comparing branches $ git diff topic master <1> $ git diff topic..master <2> $ git diff topic...master <3> Changes between the tips of the topic and the master branches. Same as above. Changes that occurred on the master branch since when the topic branch was started off it. but isn't totally clear to me. 回答1: Since I'd already

What are the differences between double-dot “..” and triple-dot “…” in Git diff commit ranges?

时光毁灭记忆、已成空白 提交于 2019-12-16 20:32:08
问题 What are the differences between the following commands?: git diff foo master # a git diff foo..master # b git diff foo...master # c The diff manual talks about it: Comparing branches $ git diff topic master <1> $ git diff topic..master <2> $ git diff topic...master <3> Changes between the tips of the topic and the master branches. Same as above. Changes that occurred on the master branch since when the topic branch was started off it. but isn't totally clear to me. 回答1: Since I'd already

Git diff of branches or commits showing file list overview in visual difftool and then selectable single file diff

穿精又带淫゛_ 提交于 2019-12-14 02:55:39
问题 tl;dr: How can I get my custom difftool to open a directory/file view of a branch or commit diff so I can jump inside of my difftool in single file diffs and back to directory list to select the next pair of files? Using git and Beyond Compare 4. (Jumping back and forth from file list to file diff and back is partly a build in feature of the difftools). Details: I have been working myself into Git the last couple of month and it is a great tool. But I was wondering if there is a possibility

Double plus sign for the last line in git-diff of merge

a 夏天 提交于 2019-12-14 02:18:41
问题 Simple conflict situation during git merge. E.g.: index e910fdc,492c972..0000000 @@@ -1,10 -1,5 +1,18 @@@ ++<<<<<<< HEAD +1 +2 +a +4 +5 +6 +b +8 +9 - newnewnew ++newnewnew ++======= + aa + aa + cc + aa -aa ++aa ++>>>>>>> br2 This is diff for not staged both modified file. I'm interested why at the end of each branch block we have lines like: +8 +9 - newnewnew ++newnewnew but not just +8 +9 +newnewnew Thanks. 回答1: TL;DR a merge conflict needs to ask the user to judge which side should do what.

Bash script to select a single Python function from a file

一笑奈何 提交于 2019-12-13 15:12:48
问题 For a git alias problem, I'd like to be able to select a single Python function from a file, by name. eg: ... def notyet(): wait for it def ok_start(x): stuff stuff def dontgettrickednow(): keep going #stuff more stuff def ok_stop_now(): In algorithmic terms, the following would be close enough: Start filtering when you find a line that matches /^(\s*)def $1[^a-zA-Z0-9]/ Keep matching until you find a line that is not ^\s*# or ^/\1\s] (that is, either a possibly-indented comment, or an indent

Gitk: Setting “Ignore space change” option to be true by default

▼魔方 西西 提交于 2019-12-12 09:35:50
问题 Is this possible in any way? I have tried git config --global alias.diff 'diff -b -w' but unfortunately that was not the solution. 回答1: Note: Now (after Sept 2014) update gitk config_variables and add ignorespace https://github.com/git/git/commit/9fabefb1f3f658e77eb18afa3f95efe1a0ee8d0d All these are flushed to .gitk file. 回答2: It's a bit old but I found that question the other day googling, and the already accepted answer gave me a hint of how to do it. No need to modify gitk itself: just