How to git diff without typing the whole path

前端 未结 4 632
太阳男子
太阳男子 2020-12-30 21:28

I\'m using the github windows shell and I\'ll do the following

git status

see a list of modified files and want to remind myself what\'s ch

相关标签:
4条回答
  • 2020-12-30 22:12

    most terminals (e.g. console2 for windows) have auto-completion.

    start typing and press tab

    usually git can auto-complete after 2 characters. like:

    gi tab di tab

    will give you git diff. if your folders are not named similarly than it might auto-complete after a single character. like if your project root had three files:

    • readme
    • /source/
    • /bin/

    you could simply type r, s, or b then tab to auto-type any of those file names.

    fyi, auto complete works for terminal and git commands, file and directory names, branch and tag names, but unfortunately not for commit ids.

    0 讨论(0)
  • 2020-12-30 22:13

    If you want to review all changes, you can simply use git diff. It will not list new files, though.

    To selectively look at changes, I would recommend to use a GUI, e.g., git gui or gitk.

    0 讨论(0)
  • 2020-12-30 22:23
    git diff -- **/FooBar.aspx
    

    In general * stands for any part of a filename while ** stands for any subpath. E.g. git diff -- **/main/**/*.aspx will diff only aspx files that are residing somewhere in a subdirectory of main or main itself. This applies to other commands that accept paths, like commit and add.

    0 讨论(0)
  • 2020-12-30 22:28

    I use Console2 to host bash.

    With this I'm able to use Ctrl + Click and Drag to highlight text which can then be copied to the clipboard and pasted into further command lines.

    I use this to copy file paths.

    This enabled me to type git diff [Ctrl+V] and get the command line I want.

    0 讨论(0)
提交回复
热议问题