git基本操作

git 基本操作

a . git add .

b. git status

c. git checkout -- filename #撤消缓存区的操作

d. git commit -m "版本名"

e. git rm #删除 文件. 对比 git add .

f. git log

g. git reflog # 查询历史版本

h.git reset -- hard HEAD^^ # 回退到 历史版本 ^ 上一个 ^^上二个版本

j. git diff HEAD HEAD^ -- test.py 对比 前二个版本 的内容

git远程仓库:方式1

 
 
 
 
 
 
1. 建议空目录  git clone  ssh仓库地址 #clone远程仓库到本地
2.git remote -V  #查询 仓库连接 上传,下载
3. git push  上传 版本
 

git远程仓库:方式2

 
 
 
 
 
 
1.先本地初始化仓库  git init
2.git pull    git@gitee.com\xxxx.git
3. git remote add  gitee git@gitee.com:jjjj\xxxx.git #gitee 为仓库名自己取  远程ssh仓库
4. 提交版本 git commit -m ""
5. git push gitee master
6. 更换远程仓库 git remote rm  gitee #先册,再加 git remote add
 

git远程仓库:方式3

 
 
 
 
 
 
远程仓库和本地都有内容,有冲突,取哪一边?
1.git remote add origin git@xxx...仓库  #连接远程仓库
2.git remote -V
# 如果不要远程的内容
3. git push origin +mater  # 强制推送本地到远程.远程文件会消失
# 如果要远程和本地的.先下载后上传
3. git pull origin master --allow-unrelated-histories
4. git push origin master # 再上传

posted on 2019-07-30 22:37  卓达  阅读(136)  评论(1编辑  收藏  举报

导航