本地和远程仓库使用git命令管理项目代码


# gitlab
http://xxxxx:8085/
user/pwd

## 初始化
cd /home/xx/projects
git clone --recursive http://xxxxx:8085/xx.git
# clone 某个分支
git clone --recursive -b 'b2' xxxx.git

# 查看所有分支
git branch

# 切换当前分支为 xxxx
git checkout xxx


cd projectname

## 每次提交前先拉取,为了避免冲突
git pull
git add ./*
git add 'dirname'
# 删除一些缓存文件
git rm -r ./**/__pycache__/*
git commit -m 'xxx'

# push master
git push

# push dev分支
git push --set-upstream origin dev


# 创建一个本地tag
git tag -a v2.1 -m '第二版本'

# 推送tag
git push --set-upstream origin dev v2.1

 

posted @ 2022-11-23 23:20  dangxusheng  阅读(19)  评论(0编辑  收藏  举报