(git) diff output relative path?

后端 未结 2 2031
说谎
说谎 2020-12-20 12:00

I need to get some diffs in my repo that are not relative to the base of the repo, but instead relative to a given base or given path.

By default I get:



        
2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-20 12:04

    git diff prints paths (of changed files) from the root of the repo - no matter where you are when executing the command.

    git diff --relative will print paths from the dir you are in.

    So if you need paths not starting from the repo-root move down (cd) to the directory (within your repo tree) where you with your paths to start from.

提交回复
热议问题