我在Git中创建了一个新分支:
git branch my_branch
Run Code Online (Sandbox Code Playgroud)
推它:
git push origin my_branch
Run Code Online (Sandbox Code Playgroud)
现在说有人在服务器上做了一些更改,我想从中拉出来origin/my_branch
.我做:
git pull
Run Code Online (Sandbox Code Playgroud)
但我得到:
You asked me to pull without telling me which branch you
want to merge with, and 'branch.my_branch.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like …
Run Code Online (Sandbox Code Playgroud) 我的〜/ .gitconfig是:
[alias]
commit = "!sh commit.sh"
Run Code Online (Sandbox Code Playgroud)
但是,当我输入git commit时,不会调用脚本.
是否可能,或者我必须使用另一个别名?
非常类似于这个问题:默认情况下如何使git log装饰
我git log
想做git log --graph
.我以为我可以像添加的东西graph = true
给[log]
我的部分~/.gitconfig
文件,但它没有工作,也没有任何其他的东西28我试图把成[log]
部分.:(
我希望我建议添加一个别名git lg
.我不想创建别名.我有两个原因:
git log
打了十多年了,我没有兴趣改变它git log
成为我用来显示git日志的单独命令.更新:我想到了一种方法,但我讨厌它.我的想法是创建一个名为bash的脚本git
,并将其放在我之前的路径中/usr/bin/git
.所有它会做的是调用/usr/bin/git
传递的任何参数,除非它是log
在这种情况下它会做同样的但是坚持--graph
./我不寒而栗
有时我有两个单词命令,git log
或者apt-get install
我想添加一个默认参数.例如,大多数时候我想将--abbrev-commit
参数添加到my git log
,并将-y
参数添加到apt-get install
.
git log --abbrev-commit
apt-get install --abbrev-commit
Run Code Online (Sandbox Code Playgroud)
但是,我似乎无法创建一个涉及两个单词命令的别名:
$ alias 'git log'='git log --abbrev-commit'
bash: alias: `git log': invalid alias name
$ alias git log='git log --abbrev-commit'
bash: alias: git: not found
Run Code Online (Sandbox Code Playgroud)
我该怎么做呢?