zsh

Github远程上传命令 mac的终端zsh 其余一样

痴心易碎 提交于 2020-02-26 14:34:08
自行终端安装git 如brew install git 进入github的repository,如没有则新建 找到clone or download的ssh地址,复制 终端cd到代码目录(文件夹),如cd target_cod_dirs(cd 文件夹名) 终端输入git clone 复制的ssh地址,如https://github.com/your_git_username/your_repository_name.git,之后会在你代码文件夹里新增一个此新建的文件夹名字是your_repository_name 复制要上传的代码/文件夹到上一步新增的文件夹your_repository_name里 终端切换到新建的your_repository_name文件夹里,使用命令 cd your_repository_name git add git commit -m "提交你项目说明的信息" git push -u origin master 把本地项目push到github 来源: oschina 链接: https://my.oschina.net/u/4013710/blog/3163126

如何与其父级进行提交?

天大地大妈咪最大 提交于 2020-02-26 09:07:34
除了编写别名或脚本之外,是否有更短的命令来获取特定提交的差异? git diff 15dc8^..15dc8 如果你只提供单个提交id git diff 15dc8 ,它会针对HEAD git diff 15dc8 该提交。 #1楼 使用别名,所以不能完全回答你的问题,但我觉得这些对你做的事情有用... alias gitdiff-1="git log --reverse|grep commit|cut -d ' ' -f2|tail -n 2|head -n 2|xargs echo|sed -e 's/\s/../'|xargs -n 1 git diff" alias gitdiff-2="git log --reverse|grep commit|cut -d ' ' -f2|tail -n 3|head -n 2|xargs echo|sed -e 's/\s/../'|xargs -n 1 git diff" alias gitdiff-3="git log --reverse|grep commit|cut -d ' ' -f2|tail -n 4|head -n 2|xargs echo|sed -e 's/\s/../'|xargs -n 1 git diff" alias gitlog-1="git log --reverse|grep commit|cut

如何使用单个命令暂存和提交所有文件,包括新添加的文件?

我的未来我决定 提交于 2020-02-26 07:40:32
如何使用单个命令暂存和提交所有文件,包括新添加的文件? #1楼 在git中提交可以是一个多步骤过程,也可以是一个步骤,具体取决于具体情况。 这种情况是您有多个文件更新并想要提交: 您必须在提交任何内容之前添加所有已修改的文件。 git add -A 要么 git add --all 之后,您可以使用提交所有添加的文件 git commit 有了这个,你必须为这个提交添加消息。 #2楼 如果您只想要一种“快速而又脏”的方法来隐藏当前分支上的更改,则可以使用以下别名: git config --global alias.temp '!git add -A && git commit -m "Temp"' 运行该命令后,您只需键入 git temp 即可让git自动将对当前分支的所有更改提交为名为“Temp”的提交。 然后,您可以使用 git reset HEAD~ 稍后“ git commit --amend 提交”更改,以便您可以继续处理它们,或者 git commit --amend 为 git commit --amend 添加更多更改和/或为其指定正确的名称。 #3楼 是否 git add -A && git commit -m "Your Message" 算作“单一命令”? 根据@thefinnomenon的答案编辑如下 : 要将它作为 git alias ,请使用:

Fedora 31

穿精又带淫゛_ 提交于 2020-02-25 21:11:53
sudo dnf install zsh zsh cat /etc/shells grep username /etc/passwd usermod --shell /bin/zsh username grep username /etc/passwd 如果shell的路径错了,重启后很可能无法正常登陆。需要像重置用户密码那样,重置用户shell。 需要注意的是,fedora救援模式下完成救援动作后,需要恢复(restore)SELinux上下文和权限: touch / .autorelabel 如果不进行上面的步骤,重启会失败。上面步骤耗时较长。 来源: oschina 链接: https://my.oschina.net/wffger/blog/3165180

git reset --hard HEAD留下未跟踪的文件

自作多情 提交于 2020-02-25 21:02:33
当我运行 git reset --hard HEAD ,它应该重置为你所提取的原始版本,据我所知。 不幸的是,它留下了文件,因为 git status 显示了一个未跟踪文件的大列表。 你怎么告诉git“只是把它带回到最后一次拉动中,没有更多,没有更少”? #1楼 如果您有文件,您仍然希望保留: git clean -di 将进行交互式清理,只允许您删除不再需要的文件/目录。 #2楼 您可能在某些时候进行了软重置,您可以通过执行来解决此问题 git add . git reset --hard HEAD~100 git pull #3楼 git reset --hard && git clean -dfx 或者,zsh提供'gpristine'别名: alias gpristine='git reset --hard && git clean -dfx' 这真的很方便。 如果使用forked repo,请确保从正确的repo / branch获取和重置,例如: git fetch upstream && git reset --hard upstream/master && git clean -df #4楼 您必须使用 git clean -f -d 来删除工作副本中未跟踪的文件和目录。 如果需要将整个存储库重置为master(包括所有git子模块),请运行以下脚本: git

基于进程退出代码退出Shell脚本

白昼怎懂夜的黑 提交于 2020-02-25 16:13:45
我有一个执行许多命令的shell脚本。 如果任何命令以非零退出代码退出,如何使shell脚本退出? #1楼 http://cfaj.freeshell.org/shell/cus-faq-2.html#11 如何在 cmd1|cmd2 获取 cmd1 的退出代码 首先,请注意 cmd1 退出代码可能不为零,但仍然不代表错误。 例如,这发生在 cmd | head -1 您可能会观察到 cmd1 的141(或269与ksh93)退出状态,但这是因为当读取一行后头 head -1 终止时, cmd 被SIGPIPE信号中断。 要知道管道元素 cmd1 | cmd2 | cmd3 的退出状态 cmd1 | cmd2 | cmd3 一个。 用zsh: 退出代码在pipestatus特殊数组中提供。 cmd1 退出代码在 $pipestatus[1] , cmd3 退出代码在 $pipestatus[3] ,这样 $? 始终与 $pipestatus[-1] 。 湾 用bash: 退出代码在 PIPESTATUS 特殊阵列中提供。 cmd1 退出代码在 ${PIPESTATUS[0]} , cmd3 退出代码在 ${PIPESTATUS[2]} ,所以 $? 总是与 ${PIPESTATUS: -1} 。 ... 有关详细信息,请参阅以下 链接 。 #2楼 [ $? -eq 0 ] ||

zsh: using “less -R” as READNULLCMD

送分小仙女□ 提交于 2020-02-25 06:34:48
问题 Now, I'm pretty sure of the limitation here. But let's step back. The simple statement READNULLCMD="less -R" doesn't work, generating the following error: $ <basic.tex zsh: command not found: less -R OK. Pretty sure this is because, by default, zsh doesn't split string variables at every space. Wherever zsh is using this variable, it's using $READNULLCMD where it should be using ${=READNULLCMD}, to ensure the option argument is properly separated from the command by a normal space. See this

zsh: using “less -R” as READNULLCMD

匆匆过客 提交于 2020-02-25 06:34:47
问题 Now, I'm pretty sure of the limitation here. But let's step back. The simple statement READNULLCMD="less -R" doesn't work, generating the following error: $ <basic.tex zsh: command not found: less -R OK. Pretty sure this is because, by default, zsh doesn't split string variables at every space. Wherever zsh is using this variable, it's using $READNULLCMD where it should be using ${=READNULLCMD}, to ensure the option argument is properly separated from the command by a normal space. See this

zsh: using “less -R” as READNULLCMD

隐身守侯 提交于 2020-02-25 06:33:13
问题 Now, I'm pretty sure of the limitation here. But let's step back. The simple statement READNULLCMD="less -R" doesn't work, generating the following error: $ <basic.tex zsh: command not found: less -R OK. Pretty sure this is because, by default, zsh doesn't split string variables at every space. Wherever zsh is using this variable, it's using $READNULLCMD where it should be using ${=READNULLCMD}, to ensure the option argument is properly separated from the command by a normal space. See this

zsh: using “less -R” as READNULLCMD

浪子不回头ぞ 提交于 2020-02-25 06:33:12
问题 Now, I'm pretty sure of the limitation here. But let's step back. The simple statement READNULLCMD="less -R" doesn't work, generating the following error: $ <basic.tex zsh: command not found: less -R OK. Pretty sure this is because, by default, zsh doesn't split string variables at every space. Wherever zsh is using this variable, it's using $READNULLCMD where it should be using ${=READNULLCMD}, to ensure the option argument is properly separated from the command by a normal space. See this