Git使用場景總結

2021-07-14 01:22:33 字數 2237 閱讀 3772

git status

git stash

git pull -r

git stash pop 如果有衝突,去解決衝突

git add .

git commit -m "tip message text"

git push

git tag -l   檢視tag列表

git tag tagname

git push --tags

git tag -d tagname

加上-a引數可以檢視遠端分支,遠端分支會用紅色表示出來(如果你開了顏色支援的話):

$ git branch -a

master

remote

tungway

v1.52

* zrong

remotes/origin/master

remotes/origin/tungway

remotes/origin/v1.52

remotes/origin/zrong

在git v1.7.0 之後,可以使用這種語法刪除遠端分支:

$ git push origin --delete 

刪除tag這麼用:

git push origin --delete tag

否則,可以使用這種語法,推送乙個空分支到遠端分支,其實就相當於刪除遠端分支:

git push origin :

這是刪除tag的方法,推送乙個空tag到遠端tag:

git tag -d git push origin :refs/tags/

兩種語法作用完全相同。

[objc]view plain

copy

qiaozhiguang

@newmedicalrecords

[dev*]$git cherry-pick -help  

usage: git cherry-pick  ...  

or: git cherry-pick 

--quit                end revert or cherry-pick sequence  

--continue

resume revert or cherry-pick sequence  

--abort               cancel revert or cherry-pick sequence  

-n, --no-commit       don't automatically commit  

-e, --edit            edit the commit message  

-s, --signoff         add signed-off-by:  

-m, --mainline parent number  

--rerere-autoupdate   update the index with reused conflict resolution if

possible  

--strategy 

merge strategy  

-x, --strategy-option 

option for

merge strategy  

-s, --gpg-sign[=id

>]  

gpg sign commit  

--ff                  allow fast-forward  

--allow-empty         preserve initially empty commits  

--allow-empty-message  

allow commits with empty messages  

--keep-redundant-commits  

keep redundant, empty commits  

將某一次提交的 內容 撤銷  

Git使用場景 命令使用場景

通過個人使用git時候的遇到的使用場景,熟悉了解相關命令,也記錄一下場景的使用方法。所有場景均在ubuntu16.04 linux 作業系統下,其他作業系統有差異的地方自行查閱相關資料。安裝git sudo apt get install git設定及檢視git配置 user.name和user.e...

Git 日常使用場景

終端下,cd到想要儲存的檔案目錄下 敲git clone 為你想要clone的遠端倉庫的master 可http可以ssh,如果被加密此處提示要輸入使用者名稱密碼,根據提示輸入即可 敲git branch r,檢視遠端版本庫分支列表,此處記得檢視路徑,git命令無效時,記得cd到子檔案敲git ch...

Git使用的常用場景

場景一 小張作為乙個開發人員,剛進團隊,發現團隊是使用git進行 管理的,現在需要去初始化團隊的 倉庫以及新增提交自己修改的一部分 1.轉殖遠端倉庫 git clone git clone git github.com walt liuzw gitdemo.git 2.修改 比如新增乙個readme...