gitHub建立分支

2021-08-15 06:44:15 字數 1525 閱讀 9134

原創 2023年07月17日 13:13:03

clone github 上的repository,如下:

git clone [email protected]:fbing/design-patterns.git
1、檢視本地分支

使用 git branch命令,如下:

$ git branch

* master

*標識的是你當前所在的分支。

2、檢視遠端分支

命令如下:

git branch -r
3、檢視所有分支

命令如下:

git branch -a
命令如下:

git

branch

[branch name]

例如:

git branch gh-dev
命令如下:

git

checkout

[branch name]

例如:

ricky@desktop-

1qpastr mingw64 /f/git_studio/design-patterns (master)

$ git checkout gh-dev

switched to branch 'gh-dev'

ricky@desktop-

1qpastr mingw64 /f/git_studio/design-patterns (gh-dev)

建立分支的同時切換到該分支上,命令如下:

git

checkout

-b[branch name]

git checkout -b [branch name] 的效果相當於以下兩步操作:

git

branch

[branch name]

gitcheckout

[branch name]

命令如下:

git

push

origin

[branch name]

例如:

git push origin gh-dev
命令如下:

git branch -d [branch name]
例如:

git branch -d gh-dev
命令如下:

git

push

origin :[branch name]

分支名前的冒號代表刪除。

例如:

git push origin :gh-dev

Github 建立新分支

clone github 上的repository,如下 git clone git github.com fbing design patterns.git1 檢視本地分支 使用 git branch命令,如下 git branch master 標識的是你當前所在的分支。2 檢視遠端分支 命令如...

Github 建立新分支

clone github 上的repository,如下 git clone git github.com fbing design patterns.git 1 檢視本地分支 使用 git branch命令,如下 git branch master 標識的是你當前所在的分支。2 檢視遠端分支 命令...

在github上建立新分支

在github上建立倉庫 create a new repository on the command line touch readme.md git init git add readme.md git commit m first commit git remote add origin gi...