前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Git prev & next

Git prev & next

作者头像
iOSDevLog
发布2020-11-12 11:03:25
7610
发布2020-11-12 11:03:25
举报
文章被收录于专栏:iOSDevLogiOSDevLog

Git prev & next

GIT

When you are doing a talk with a demo in several steps, it can be practical to have a git repository with a commit for each step. During the demo, when you want to go to the next step, all you have to do is moving to the next commit. But, except if you know the sha1 of this commit, it can be tricky to do that without interrupting your talk. I have two git aliases to suggest for this task (in ~/.gitconfig):

代码语言:javascript
复制
[alias]
    prev = checkout HEAD^1
    next = "!sh -c 'git log --reverse --pretty=%H master | awk \"/$(git rev-parse HEAD)/{getline;print}\" | xargs git checkout'"

With them, you can move to the next step with a simple git next and come back to the previous step with git prev. Just be warned, it'll only works on the master branch.

原文:https://coderwall.com/p/ok-iyg/git-prev-next

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Git prev & next
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档