檢視git的遠端主機名 Git日常開發常用命令彙總

2021-10-14 08:25:30 字數 1879 閱讀 7128

出自:shusheng007

實際專案中如何使用git做分支管理

@[toc]

在任意分支上執行

git checkout -b b  a
如果在a 分支上執行,那麼上面語句的a可以省略

在任意分支上執行

git checkout -b b origin/a
git fetch 《遠端主機名》

git fetch
上面命令將某個遠端主機的更新,全部重新整理回本地。

git fetch origin master
將遠端origin主機的master分支commit 重新整理到本地。

預設情況下,重新整理回來的資料在.git/fetch_head

在非a的分支上執行

git branch -d a
在非a的分支上執行

git branch -d a
在任意分支上執行

git push origin --delete a
在分支b分支上執行

$ git merge --no-ff  a
上面**的--no-ff 表示不用快速合併

1.git remote add origin 倉庫位址 2.git pull origin master 同步遠端倉庫 3.add . commit .... 4.git push -u origin master

git config --system --unset credential.helper
或者

git config --global --unset credential.helper
輸入q鍵即可

只要將本地分支push到遠端就可以了

$ git push origin test:origin/test
上面的命令用本地分支test在遠端建立了乙個test分支

git push --set-upstream origin branch_name
上面的命令將當前本地分支與名為branch_name的遠端分支關聯

git push --unset-upstream origin branch_name
上面的命令將當前本地分支與名為branch_name的遠端分支取消關聯

git checkout --track origin/branch_name
從遠端branch_name分支建立本地同名分支並關聯

git checkout -b new_branch_name origin/branch_name
上面的命令以branch_name的遠端分支建立本地分支new_branch_name

git branch -r
git clone -b [remote repository address]

$ git clone
上面的命令轉殖我github上的預設主分支:master

$ git clone -b newbranch
上面的命令轉殖我github上的名為newbranch的乙個分支

檢視git的遠端主機名 Git遠端協作常用命令詳解

下圖是git常用的6個命令,這張圖有助於理解每個命令到底產生了哪些影響。其中的幾個專用名詞 workspace 工作區 index stage 暫存區 repository 倉庫區 或本地倉庫 remote 遠端倉庫 下圖是利用github專案協作的簡單示意圖 一 增加新的遠端主機 在clone或者...

linux檢視主機名

vi etc sysconfig network networking yes networking ipv6 no hostname idc 183 主機名 root idc 183 release cat etc hosts do not remove the following line,or...

Linux 檢視修改主機名(hostname)

在實際工作中,搭建集群等很多時候需要用到主機名hostname和修改主機名,這裡記錄一下 直接使用hostname命令就可以檢視到當前主機名 hostname當然也可以使用hostnamectl hostnamectl修改主機名有很種方式,先介紹最簡單的一種 使用hostnamectl命令 語法規則...