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

Git常用命令

时间:2018-07-13 18:55:57      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:hello   style   git reset   col   内容   文件夹   init   config   use   

git init    初始化Git仓库

git add    具体文件名

git status   查看当前状态名

git config --global user.email  "你的邮箱名”

git config --global user.name "你的名字"

git commit -m ‘‘ 描述提交的内容

git log    查看版本

HEAD表示当前版本 上一个版本^HEAD 上上一个版本^^HEAD

回滚到上一版本 git reset --hard HEAD^

指定回到某个版本 git reset --hard  版本号(版本号至少前五位)

git reflog    查看之前的命令

git checkout -- hello.txt   撤销对hello.txt文件的修改(工作区)

git reset HEAD hello.txt   撤销暂存区修改(已经git add hello.txt)

git checkout --hello.txt  工作区删错了,可以在版本库恢复

 

从远程库克隆

文件夹右键  点击Git  Bash Here

输入命令 git clone 具体地址

git checkout -b dev    创建新的分支dev,并且切换到dev分支

git branch   查看分支  前面有*代表当前分支

git merge <name>     合并某分支到当前分支 (master)

git  branch -d <name>   删除分支

git   pull    更新代码

git   push   提交代码

Git常用命令

标签:hello   style   git reset   col   内容   文件夹   init   config   use   

原文地址:https://www.cnblogs.com/zhaoyini/p/9290553.html

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