Golang learning log━━ Learn github operations by uploading the gin-vue-admin project to your own warehouse and keeping it updated with the original version

Gin-vue-admin is a set of background management system developed by Chinese people using golang. This article is a part of the author's early original text, which will be expanded later with this article as the framework.
Official website: https://www.gin-vue-admin.com/
Learning video: https://www.bilibili.com/video/BV1kv4y1g7nT/?p=6

insert image description here

Push your own code to github for management

1. Create your own warehouse on github

insert image description here

2. Initialize your own warehouse locally

Open the terminal in the root directory of gin-vue-admin and execute

git init

3. Push the code to your own warehouse

git remote add origin git@github.com:haimait/ginvueadmintest.git # 设置并联到自己的master分支上
git add .   #添加代码到运送车
git commit -m"第一次提交代码到master仓库"   #提交运送车上所有代码到本地仓库
git push -u origin master

At this point, I have pushed my code to the master branch of my github warehouse

4. Create master_dev development branch

create on masterbranch and switch to master_devbranch

git checkout -b master_dev  #创建并切换到master_dev分支上
git push --set-upstream origin master_dev  # 设置并联到自己的分支上
git add .   #添加代码到运送车
git commit -m"第一次提交代码到master_dev"   #提交运送车上所有代码到本地仓库
git push #推送代码到线上仓库

At this point, I have pushed my code to my github master_devbranch

insert image description here

Update author source project code

If the author's project is updated, we want to pull the author's new code. You can do the following

git remote add upstream https://github.com/piexlmax/gin-vue-admin.git #关联源分支,并启别名为upstream
git remote -v #查看已经关连上的项目
git fetch upstream #下载作者源项目的所有分支
git branch -a #查看自己本地所有的分支
git merge upstream/master #合并作者master分支的代码到自己的当前所在的分支上

After merging the code, if there is a conflict, resolve the conflict, then submit the code to your own local creation, and then push to your github online warehouse

git status #查看自己的本没有提交的代码,如果有冲突用这个命令也可以看到是哪个文件冲突了,然后自己修改一下冲突
git add . #添加代码到运送车
git commit -m"合并冲突" #提交运送车上所有代码到本地仓库
git pull #更新一下自己线上的代码,如果有冲突再解决一下冲突 再执行一下 git add .  git commit -m
git push #推送到代码到自己的线上仓库里

At this point, the updated author's code is merged into his designated code branch and submitted to his own github warehouse.

Reference:
gin-vue-admin development tutorial 01 installation and activation

Guess you like

Origin blog.csdn.net/snans/article/details/131366167