Git t 常用命令

2021-10-05 13:36:57 字數 4568 閱讀 6565

配置增加/刪除檔案

分支標籤

檢視資訊

遠端同步

顯示所有遠端倉庫

顯示某個遠端倉庫的資訊

增加乙個新的遠端倉庫,並命名

取回遠端倉庫的變化,並與本地分支合併

上傳本地指定分支到遠端倉庫

強行推送當前分支到遠端倉庫,即使有衝突

推送所有分支到遠端倉庫

撤銷其他

git是建立 linux 作業系統創始人建立的,命令和linux命令非常像

$ git init
$ git init [project-name]
$ git clone 碼雲的位址
$ git config --list
$ git config -e [

--global]

$ git config [

--global] user.name "[name]"

$ git config [

--global] user.email "[email address]"

$ git add 檔案1、檔案2...

..

$ git add 資料夾
$ git add .
$ git add -p
$ git rm 檔案1、檔案2...

...

$ git rm --cached 檔案
$ git mv [file-original]

[file-renamed]

#**提交

$ git commit -m [message]
$ git commit [file1]

[file2]..

.-m [message]

$ git commit -a
$ git commit -v
使用一次新的commit,替代上一次提交
$ git commit --amend -m [message]
$ git commit --amend [file1]

[file2]..

.

$ git branch
$ git branch -r
$ git branch -a
$ git branch [branch-name]
$ git checkout -b [branch]
$ git branch [branch]

[commit]

$ git branch --track [branch]

[remote-branch]

$ git checkout [branch-name]
$ git checkout -
$ git branch --set-upstream [branch]

[remote-branch]

$ git merge [branch]
$ git cherry-pick [commit]
$ git branch -d [branch-name]
$ git push origin --delete [branch-name]

$ git branch -dr [remote/branch]

$ git tag
$ git tag [tag]
$ git tag [tag]

[commit]

$ git tag -d [tag]
$ git push origin :refs/tags/

[tagname]

$ git show [tag]
$ git push [remote]

[tag]

$ git push [remote]

--tags

$ git checkout -b [branch]

[tag]

$ git status
$ git log
$ git log --stat
$ git log -s [keyword]
$ git log [tag] head --pretty=format:

%s

$ git log [tag] head --grep feature
$ git log --follow [file]

$ git whatchanged [file]

$ git log -p [file]
$ git log -

5--pretty --oneline

$ git shortlog -sn
$ git blame [file]
$ git diff
$ git diff --cached [file]
$ git diff head
$ git diff [first-branch]..

.[second-branch]

$ git diff --shortstat "@"
$ git show [commit]
$ git show --name-only [commit]
$ git show [commit]

:[filename]

$ git reflog
$ git fetch [remote]
$ git remote -v
$ git remote show [remote]
$ git remote add [shortname]

[url]

$ git pull [remote]

[branch]

$ git push [remote]

[branch]

$ git push [remote]

--force

$ git push [remote] --all
$ git checkout [file]
$ git checkout [commit]

[file]

$ git checkout .
$ git reset [file]
$ git reset --hard
$ git reset [commit]
$ git reset --hard [commit]
$ git reset --keep [commit]
$ git revert [commit]

暫時將未提交的變化移除,稍後再移入

$ git stash

$ git stash pop

$ git archive

docker常用命令 Docker 常用命令筆錄

格式docker run 選項 映象 命令 引數.示例docker run it rm ubuntu 16.04 bash 示例解釋 it 這是兩個引數,乙個是 i,表示互動式操作,乙個是 t表示終端 rm 這個引數是說容器退出後隨之將其刪除 ubuntu 16.04 這是指用ubuntu 16.0...

常用命令 Git 常用命令大全

安裝教程可參照 廖雪峰老師的安裝教程。git config 在git中,使用git config 命令來配置 git 的配置檔案,git配置級別主要有3類 1 倉庫級別 local 本地 git 倉庫級別配置檔案,作用於當前倉庫。優先順序最高 2 使用者級別 global,全域性配置檔案,作用於所有...

Linux常用命令 vi vim常用命令介紹

vi vim是linux系統自帶的乙個功能豐富的文字編輯器 命令字元 介紹dd 雙擊d 剪下當前行 num dd 雙擊d 剪下當前行 例如10dd可以刪除10行 yy拷貝當前行 p將內容貼上至游標所示位置 命令 說明 set number 頁面顯 hi 檢視當前系統提供的高亮模式 match col...