有多少人完全使用命令行管理 git 得

2023-09-09 14:54:44 +08:00
 iorilu

有多少人从来不用 gui 软件管理 git 呢

有什么经验分享下吗

15311 次点击
所在节点    程序员
203 条回复
CatCode
2023-09-09 21:23:53 +08:00
操作,比如 clone/add/commit/revert/checkout/merge 等都是用命令行
查看,比如 log/diff 等用 GUI
wsssss
2023-09-09 21:24:00 +08:00
解决冲突用 GUI ,操作都用命令行。
xchaoinfo
2023-09-09 21:26:07 +08:00
基本都是命令行,在解决冲突和对比代码更改的时候会用 GUI
zy5a59
2023-09-09 21:44:26 +08:00
除了太多冲突要解的时候会用 GUI ,其他都直接用命令行,不过有时候确实不如 GUI 看着方便
wpzz
2023-09-09 21:49:56 +08:00
用 zsh ,然后上 git 简写命令
比如
GIT Alias
g git
ga git add
gaa git add --all
gapa git add --patch
gau git add --update
gav git add --verbose
gap git apply
gapt git apply --3way
gb git branch
gba git branch --all
chaleaochexist
2023-09-09 21:56:37 +08:00
有谁 git log 也用命令行看 那是真牛逼啊.
chaleaochexist
2023-09-09 21:57:11 +08:00
@ea3ba5c0 老哥 git log 怎么看?
misaka
2023-09-09 21:57:34 +08:00
一直命令行,GUI 点着好累
zliea
2023-09-09 22:29:41 +08:00
这玩意不是哪个方便,哪个清楚用哪个?
zliea
2023-09-09 22:30:36 +08:00
@chaleaochexist
git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
Mutoo
2023-09-09 22:33:41 +08:00
jetbrains 的 three way merge 不要太好用!
expkzb
2023-09-09 22:35:19 +08:00
反倒不会用 gui
lcdtyph
2023-09-09 22:39:09 +08:00
@chaleaochexist #66
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset %C(yellow)[%ae]%Creset' --abbrev-commit --date=iso

可以建一个 git alias:
git config --global alias.clog "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset %C(yellow)[%ae]%Creset' --abbrev-commit --date=iso"
以后就可以直接 git clog
xiangyuecn
2023-09-09 23:07:33 +08:00
问,问就是 commit 前从来不检查文件差异,随时 commit 几个 G 文件进去,顺手就是一个 push ,第二天发帖问怎么删提交记录😂
d0x0b
2023-09-09 23:37:09 +08:00
没必要纠结这个,自己用的那个舒服就哪个啊
YsHaNg
2023-09-09 23:40:40 +08:00
@defunct9 vscode remote
YsHaNg
2023-09-09 23:42:22 +08:00
@chaleaochexist 免配置的可以记我上面那个 a dog🤣
littlewing
2023-09-09 23:53:39 +08:00
从来不用 GUI ,不会用,命令行多好用,唯一用到过 GUI 的地方就是看看各个分支的继承关系,那个看图比较方便
hamsterbase
2023-09-10 00:00:00 +08:00
我只用命令,推荐一下我常用的 alias 。


alias grb="git rebase"
alias gaa="git add -A"
alias gap="git add -p"
alias gc="git checkout"
alias gs="git status"
alias gm="git commit"
alias gdc="git diff --cached"
alias grh="git reset HEAD"

gmm() {
git commit -m "$1"
}
hamsterbase
2023-09-10 00:02:55 +08:00
alias gl="git log --pretty=format:\"%C(auto)%h %C(magenta)<%ad> %C(green)[%an] %C(blue normal bold)| %Creset%s%C(auto)%d\" --graph --date=short"

上面都在说 git log , 就再推荐一个 alias 。 效果是下面这样的。




* 02bb711 <2023-09-03> [monster] | docs: relase 0.9.1 (HEAD -> main, tag: 0.9.1, origin/main)
* cf663e7 <2023-09-01> [monster] | chore: release 0.9.0
* 1b0aba5 <2023-07-21> [monster] | chore: release 0.8.1 (tag: 0.8.1)
* bdde57c <2023-07-15> [monster] | chore: release 0.8.0 (tag: 0.8.0)
* fbdce73 <2023-07-07> [monster] | feat: release 0.7.3 (tag: 0.7.3)

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/972261

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX