Git用于Windows分页 [英] Git for windows paging

查看:175
本文介绍了Git用于Windows分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我执行 git log 命令时,它都不能被终止。如果我按Ctrl + C,它会退出分页环境,但如果我开始键入任何内容,它会再次启动 git log 命令。

如前所述, git log -X 会限制你的输出到最后的X个提交。



Git log和其他git命令调用 less 命令。这是寻呼机。要获得寻呼机的帮助,请输入?或者当查看输出时为h。您现在将看到 less 命令的帮助。如果您不想使用传呼机实用程序,则只需键入 q



你可以指示git不要使用它:

  git --no-pager log 

Git log有很多选项。为了快速了解发生的情况,我使用

  git log --all --graph --online --decorate 

可以将Decorate设置为默认启用,因此您无需发布它。

如果您认为在命令行上编写很多内容,您是对的! Bash有一个快速的补救措施: CTRL-R 。按下并开始输入'图表'。你应该得到你最后一次键入那个长命令。这是我不打扰git别名的原因之一;你可以很容易地搜索你的命令历史记录,这个历史记录从会话到会话持续存在。



此外,您可以限制 git log 给特定的作者或特定的日期范围等。

开心探索并坚持命令行。这就是git的用意。你也将被介绍到许多优秀的bash技术,这将帮助你一吨,因为你进一步与git。


Whenever I execute git log command it cannot be terminated. If I do Ctrl + C it exits paging environment but if I start to type anything it starts git log command again.

解决方案

as mentioned already, git log -X will limit your output to the last X commits.

Git log and other git commands invoke the less command. This is the pager. To get help with the pager, type ? or h when looking at the output. You will now see the help for the less command. Quitting less is easy, just type q.

If you don't want log to use a pager utility, you can instruct git not to use it with:

git --no-pager log

Git log has a lot of options. To get a quick overview of what has happened, I use

git log --all --graph --online --decorate

Decorate can be set to be enabled by default through config so you don't have to issue it.

If you think that's a lot to write on the command line, you're right! Bash has a quick remedy for that: CTRL-R. Press that and start typing 'graph'. You should get the last time that you typed that long command. This is one reason I don't bother with git aliases; it's easy to search your command history which persists from session to session.

Further, you can limit the output of git log to a particular author or particular date range, etc.

Have fun exploring and stick to the command line. It's what git was meant to be used on. You will also be introduced to a lot of excellent bash techniques that will help you a ton as you get going further with git.

这篇关于Git用于Windows分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆