git命令学习之clone指定分支代码
今天要拉取一个项目,但是是一个指定分支,本来我以为直接git clone就行,但是发现好像不能,报错:
Cloning into 'lecture'...
fatal: unable to update url base from redirection:
asked for: XXXXXXX
redirect: XXXXXX
后来在网上查了一下,要clone指定分支是 git clone -b 指定分支名称 项目ssh地址
这样就可以拉取指定分支代码了
git clone -b feature***beAsk https://gitlab.******Lite.git
feature***beAsk 是你的分支名字, https://gitlab.******Lite.git是分支的http地址
git branch 用于看当前的分支,一定要进入当前的工程目录下查看
---------------------------------------------
Command line instructions
You can also upload existing files from your computer using the instructions below.
Git global setup
git config --global user.name "赵**"
git config --global user.email "11***4478@qq.com"
Create a new repository
git clonegit@gitlab.o***.com:ios/tra***ask_ios.git
cd trad***dask_ios
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Push an existing folder
cd existing_foldergit init
git remote add origingit@gitlab.***.com:ios/tra***ask_ios.git
git add .git commit -m "Initial commit"git push -u origin master
Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origingit@gitlab.o***.com:ios/tr****sk_ios.git
git push -u origin --all
git push -u origin --tags
网友评论