diff

How to exclude files & directories from git diff --no-index

笑着哭i 提交于 2020-08-24 22:13:29
问题 How do I exclude files & directories from git diff --no-index ? For example, I want to show the differences between two directories project1 & project2 while ignoring their top-level .git directories ( project1/.git & project2/.git ) and all their .DS_Store files. 回答1: This is not exactly what you asked for, but it might give you the results you want: Add project2 as a remote of project1 and just git diff their HEAD s. git remote add other ../project2/.git git fetch other # Perform the diff

Linux diff get only line number in the output

99封情书 提交于 2020-08-19 10:34:00
问题 I want to use linux diff command to get the following output: 2,4c2,4 I only want to know the line numbers where the files are different. I don't want the actual line on the console. Eg: If I will execute the following command: diff file1.txt file2.txt I would like the following output: 2,4c2,4 I don't want the output: 2,4c2,4 < I need to run the laundry. < I need to wash the dog. < I need to get the car detailed. --- > I need to do the laundry. > I need to wash the car. > I need to get the

Linux diff get only line number in the output

﹥>﹥吖頭↗ 提交于 2020-08-19 10:32:59
问题 I want to use linux diff command to get the following output: 2,4c2,4 I only want to know the line numbers where the files are different. I don't want the actual line on the console. Eg: If I will execute the following command: diff file1.txt file2.txt I would like the following output: 2,4c2,4 I don't want the output: 2,4c2,4 < I need to run the laundry. < I need to wash the dog. < I need to get the car detailed. --- > I need to do the laundry. > I need to wash the car. > I need to get the

Linux diff get only line number in the output

孤街醉人 提交于 2020-08-19 10:32:22
问题 I want to use linux diff command to get the following output: 2,4c2,4 I only want to know the line numbers where the files are different. I don't want the actual line on the console. Eg: If I will execute the following command: diff file1.txt file2.txt I would like the following output: 2,4c2,4 I don't want the output: 2,4c2,4 < I need to run the laundry. < I need to wash the dog. < I need to get the car detailed. --- > I need to do the laundry. > I need to wash the car. > I need to get the

Linux diff get only line number in the output

被刻印的时光 ゝ 提交于 2020-08-19 10:31:57
问题 I want to use linux diff command to get the following output: 2,4c2,4 I only want to know the line numbers where the files are different. I don't want the actual line on the console. Eg: If I will execute the following command: diff file1.txt file2.txt I would like the following output: 2,4c2,4 I don't want the output: 2,4c2,4 < I need to run the laundry. < I need to wash the dog. < I need to get the car detailed. --- > I need to do the laundry. > I need to wash the car. > I need to get the

Git diff - ignore reorder

前提是你 提交于 2020-08-19 06:17:06
问题 git diff numbers diff --git a/numbers b/numbers index 5f5fbe7..d184fef 100644 --- a/numbers +++ b/numbers @@ -1,3 +1,3 @@ -1 +4 +3 2 -3 Number 3 is repeated but the order is changed. Any way to ignore the reorder in git or any grep solution? I want the result of only added and deleted numbers, not reordering of the same numbers Any help? 回答1: The diffing tools are usually implemented in terms of the Myers' diff algorithm. There isn't much that you can do to control the behaviour of GNU/git

Does git apply -p (leading slash removal) not work for renames?

我的梦境 提交于 2020-08-10 20:36:47
问题 Here is a simple diff file from git diff --no-index --no-prefix dir1 dir2 > dir.diff : diff --git dir1/file1.txt dir2/file1.txt index 45b983b..ce01362 100644 --- dir1/file1.txt +++ dir2/file1.txt @@ -1 +1 @@ -hi +hello diff --git dir1/file2.txt dir2/file2_rename.txt similarity index 100% rename from dir1/file2.txt rename to dir2/file2_rename.txt diff --git dir1/file3.txt dir1/file3.txt deleted file mode 100644 index b1a17ba..0000000 --- dir1/file3.txt +++ /dev/null @@ -1 +0,0 @@ -zzz diff -

Does git apply -p (leading slash removal) not work for renames?

老子叫甜甜 提交于 2020-08-10 20:31:36
问题 Here is a simple diff file from git diff --no-index --no-prefix dir1 dir2 > dir.diff : diff --git dir1/file1.txt dir2/file1.txt index 45b983b..ce01362 100644 --- dir1/file1.txt +++ dir2/file1.txt @@ -1 +1 @@ -hi +hello diff --git dir1/file2.txt dir2/file2_rename.txt similarity index 100% rename from dir1/file2.txt rename to dir2/file2_rename.txt diff --git dir1/file3.txt dir1/file3.txt deleted file mode 100644 index b1a17ba..0000000 --- dir1/file3.txt +++ /dev/null @@ -1 +0,0 @@ -zzz diff -

Is it possible to patch a submodule in Git from the parent project?

偶尔善良 提交于 2020-07-27 07:10:47
问题 I have a project main that contains a submodule foo . For this particular project, I would like to make a small change to foo that only applies to this particular project main . main/ + .git + main.c + lib/ | + bar.c + foo/ # My `foo` submodule + .git + config.h # The file I want to patch from `main` + ... A common solution would be to go down to my submodule, make a commit Applied patch for main on a new branch called main-project , then push it. Unfortunately, this is a very bad approach

How can I generate offline diff output between two views?

梦想与她 提交于 2020-07-19 07:06:08
问题 I am working on analyzing different files between two views in Clearcase. I need to generate output so that I can do this task without an internet connection. What I would like is to run a command that recursively walks through each view and generates a merge/diff output file for each change from view A to view B. This can work like a merge, except that I don't actually want to make any changes. How can I set this up so that I can continue looking at diff output amidst all of these files