linux - 如何在不使用 git 命令的情况下推送
问题描述
将分支合并到另一个分支后(如发展为主分支)
git merge --no-ff develop
如果你git status
在终端 jsut 中执行 git 命令后你会看到:
On branch master
Your branch is ahead of 'origin/master' by 1 commits.
(use "git push" to publish your local commit)
nothing to commit, working tree clean
Wich 与此没有太大区别(如果我们不注意看的话):
On branch master
nothing to commit, working tree clean
有时我不太注意,我忘了推。那么是否有命令知道我们是否必须推送?或一种将Your branch is ahead of 'origin/master' by 1 commits.
零件涂成红色的方法?
或者如果我们需要推送,可能只是一个返回 0 或 1 的命令,如果是,我可以将它包含echo
在 git 别名中的例程中以使我git status
更明确。
解决方案
最后,我把它放在我的~/.gitconfig
:
[alias]
st = "!f() { git status -u; \
git status -u | grep \"Your branch is ahead\" > /dev/null \
&& echo \"\\e[31m[WARNING]\\e[91m You need to push :)\"; }; f"
就像那样,git st
如果我需要推送,我会通过执行红色消息来警告我。
推荐阅读
- r - 根据 r 中一列的条件随机删除行
- android - 如何解决这个问题以在颤振中传递参数?
- windows - Windows:系统映像是否还包括已删除的数据
- javascript - 在提交表单之前将 Formik 字段数组重置为空数组
- elasticsearch - 如何在 elasticseach 中重新创建索引
- flutter - 方向性(textDirection:TextDirection.rtl,)在颤动中不起作用
- flutter - 在函数中等待条件满足无限时间 :: 应用于频繁变化的特定值的条件(Flutter,Dart)
- java - Lint 检查不适用于 Java,但适用于 Android Studio 中的 Kotlin
- pine-script - 被盈亏所迷惑
- laravel - “搜索”不再找到任何结果