Git 日常pull and push 用法

2021-10-09 13:59:10 字數 739 閱讀 3928

在伺服器上測試指令碼時,快速pull 和push 的指令碼,會省很多時間

git_pull.sh

#!/bin/bash

set -x

cd /etc/ansible/roles/coding

git checkout .

git pull

sleep 1

git_push.sh
備註: expect linux 上預設不帶,需要手動安裝  yum install -y expect 即可

#!/usr/bin/expect -f

set -x

git add .

read -p "請輸入commit 資訊": commitmessage

git commit -m "$"

#git 到遠端伺服器上 需要輸入使用者名稱和密碼

user=abcd

password=abcd@123

expect << eof

spawn git push

#expect "username for '':"

expect "username*"

send "$\r"

#expect "password for '"

expect "password*"

send "$\r"

expect eof;

eof

git日常命令

文總結了日常開發中git的常用命令,會逐步更新。1 回退到上乙個commit的版本 引用git reset hard head 1 head is now at 907af0c x some comments 這個命令很危險,他會徹底刪除最近一次提交的 不可恢復。而且在執行這個命令時,如果工作區還有...

git使用日常

1.關於git手動刪除檔案如何處理 執行命令 git add a 或者git add all 進行全文新增,然後commit 2.關於git首次使用新增使用者命令 git config global user.name yangchuan git config global user.email y...

git日常問題

在2016年的時候,我建立了自己的github,當時只是跟風,覺得大家都在使用github,自己也要有乙個,其次就是想有乙個自己的部落格,閨蜜之前自己搭載了乙個gitpage hexo的部落格,容易上手,就想學一下,沒想到過程坎坷 到現在也不是很怎麼會使用github,但是已經稍有了解了 之前我使用...