Posts git多仓库与回滚
Post
Cancel

git多仓库与回滚

CSDN 的教程真的是鱼龙混杂。写一下。

git 版本回滚问题。

1
2
3
4
5
$ git log 查找历史版本信息 
$ git reset --hard HEAD^ 回滚到上一个版本
$ git push -f origin master 强行提交
// 此时已经可以看到仓库中版本信息变化了 但本地还需跟远程仓库同步
$ git pull 与远程同步

本地关联远程仓库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//  全局变量设置
$ git config --global user.name "justxyx"
$ git config --global user.email "yx_xiao95@163.com"


// 码云  //github
git init 
git remote add origin https://gitee.com/justxyx/test.git
git commit -m "first commit"
git push -u origin master

git pull 同步


 #查看关联的远程仓库的详细信息
 git remote -v 
 #添加远程仓库的关联
 git remote add origin [远程仓库地址] 
 #删除远程仓库的关联
 git remote remove [远程仓库名称] 
 #更新远程仓库的分支
 git remote update origin --prune
This post is licensed under CC BY 4.0 by the author.

Contents

Trending Tags