gitlab 克隆clone下载代码到本地push pull 上传代码 常用命令

本文详细介绍了使用GitLab进行代码管理的全过程,包括克隆项目、创建和切换分支、提交和推送代码等核心操作,适合初学者快速上手。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

gitlab 克隆clone下载代码到本地push pull 上传代码 常用命令

gitlab常用命令


#克隆代码到本地
git clone http://XXX个人库XXX.git`

cd XXXXXX

git branch -a  #查看分支信息
git remote -v  #查看当前远程仓库

#切换分支
git branch 分支名称   ---新建分支
git checkout 分支名称    ---切换分支

#添加自己仓库地址
git remote add origin https://gitlab.navinfo.com/xujun/ComputerVision.git

#先更新本地代码
git pull origin master

#查看代码状态,红色字体为修改过的
git status

#提交所有修改代码
git add .

#用于显示工作目录和暂存区的状态,绿色部分为提交成功的部分
git commit -m "自己想写的提交备注"

#上传修改代码
git push -u origin 分支名  
git push origin master  # 直接推给 master

#最后去网络端,申请merge

当新建了一个project时,操作指令:

The repository for this project is empty
You can create files directly in GitLab using one of the following options.

Command line instructions
You can also upload existing files from your computer using the instructions below.


Git global setup
git config --global user.name "许军05730"
git config --global user.email "xujun@navinfo.com"

Create a new repository
git clone https://gitlab.navinfo.com/computervision/labeloperate.git
cd labeloperate
touch README.md
git add README.md
git commit -m "add README"

Push an existing folder
cd existing_folder
git init
git remote add origin https://gitlab.navinfo.com/computervision/labeloperate.git
git add .
git commit -m "Initial commit"

Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab.navinfo.com/computervision/labeloperate.git
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值