Ani
Ani

Reputation: 1526

Unable to get complete patch with git

In a git repo, I had new file additions, file removal/renames with modifications as usual. When I took a git diff to patch in another view, I did not get all the new/removed files. Then I tried with --cached option, then, I got some different file set, but still, not the complete set of all changes + file additions and removals. (I had done a git add and git rm) I also tried --diff-filter=ACDMRTUXB, still didnt help! Am I missing some other option ? all I want is to get the full set of diffs in 1 command. I have git version 1.6.2.4 on my Linux machine.

--

TIA

Upvotes: 3

Views: 1383

Answers (1)

Useless
Useless

Reputation: 67733

So:

  • git diff shows unstaged changes in tracked files (you added the file at some point, but haven't added these specific changes)
  • git diff --cached shows staged changes (ones you've already added)

It sounds like you have a mixture of staged and unstaged changes in your working copy. If you want to get them all into the same patch, you can either:

  • unstage your changes: git reset will empty the staged changes from your index but leave them in your working copy, so git diff will give you the complete patch now
  • stage all the changes: just git add the remaining files to your index: then git diff --cached will give you the complete patch

Upvotes: 3

Related Questions