I'm on a Mac El Capitan using iTerm2, is there a command to show/enable paging when using git checkout branchName or simply output the error/result that is displaying on the terminal screen to a file? Currently when I use git checkout branchname, it fills the whole screen and then at the very bottom it says, "Please move or remove them before you can switch branches. Aborting." but I'm not sure what the start of the error is so I need a way to see at the very top of the message. I have tried git checkout branchname > error.log but nothing was captured in the log file. Any suggestion is much appreciated.
>error.log
will only redirect stdout
, but the error is probably output to stderr
, so either do 2>error.log
to redirect stderr
to the file, or &>error.log
to redirect both to the file. If the latter does not work, you are maybe not using Bash and >error.log 2>&1
will do the same. (the order is important for the last one)