Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the commands for using Git Bash in Windows e.g. when in git diff mode?

Tags:

git

bash

windows

In Windows, in Git Bash, if I do a git diff I get all the differences flushed to the console with some sort of prompt to control the output buffer. What are the commands I can use in this mode of Git Bash? I don't know where to look for a quick reference.

I've worked out that <Enter> will scroll one line, and <Space> will scroll all lines, but not much more than that. To quit I do a Ctrl-C, which seems to go back to a command prompt, but then sometimes when I start typing a new command it seems to go back to the unfinished diff output and I'm confused as to why.

Really dumb question, I know.

like image 592
Gavin Avatar asked Aug 12 '10 04:08

Gavin


People also ask

How do I use the diff command in git?

You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch. Order does matter when you're comparing branches.

Which of the command is used to see the diff in git?

git diff --cached --merge-base A is equivalent to git diff --cached $(git merge-base A HEAD) . This form is to view the changes you have in your working tree relative to the named <commit>. You can use HEAD to compare it with the latest commit, or a branch name to compare with the tip of a different branch.

How do I use git Bash on Windows?

Launch Git Bash console by clicking on the Start button, type git, and click on Git Bash. 2. Run the below git config command to add your name ( YourName ) as your git username ( user.name ). The git config command administers configuration variables that control how Git looks and operates.


1 Answers

git diff pipes the diff file into the Unix less pager. Press h when the diff view is open to see a bunch of commands. The particularly important ones to know:

  • h - Display help/commands
  • q - Quit/close
  • [Space] scroll 'k' lines ahead, where k should default to your terminal's line display height.
  • [Enter] scroll 'k' lines ahead, where k defaults to 1
like image 174
eldarerathis Avatar answered Oct 19 '22 15:10

eldarerathis