开发者

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 go开发者_运维百科t 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


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜