码迷,mamicode.com
首页 > 其他好文 > 详细

【快速上手】Git的使用教程

时间:2020-02-21 18:31:02      阅读:71      评论:0      收藏:0      [点我收藏+]

标签:status   touch   远程分支   本地仓库   eset   内容   commit   ignore   comm   

创建Git仓库

git init

查看当前仓库情况

git status

添加修改

git add (file) or git add .

查看未提交的修改

git diff

撤销提交操作

git reset

提交自己的身份

git config --global user.name "xxx"
git config --global user.email "xxx@xxx.com"

向git提交内容

git commit -m ""

将本地仓库变为远程仓库

git remote add origin (adress)

忽略提交文件

touch .gitignore  and add files to .gitignore

不再追踪某个文件

git rm --cached (file)

添加分支

git branch (name)

切换分支

git  checkout (name)

合并分支

git merge (name)

列出本地分支

git branch -a

删除分支

git branch -d (name)  or -D(Mandatory deletion)

设置本地分支追踪远程分支

git push --set-upstream

【快速上手】Git的使用教程

标签:status   touch   远程分支   本地仓库   eset   内容   commit   ignore   comm   

原文地址:https://www.cnblogs.com/huanhao/p/usegit.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!