搜索
 找回密码
 立即注册

简单一步 , 微信登陆

Git 命令小结-1

作者:creass | 时间:2016-9-27 09:49:32 | 阅读:4185| 只看该作者
Git clone 获取代码
Git pull 更新服务器的代码到本地
git reset --hard HEAD/具体版本号 本地改动不做任何保存的恢复



  • 出现 * (no branch)的处理
如果当前正工作在 (no branch)上:
$ git checkout -b working,就会把(no branch)上的东西checkout到working分支
如果不小心从(no branch)branch切换到其他分支了,用git log不能查找到(no branch)的信息,不要担心,先用gitreflog查到(no branch)的commit,然后:
$ git checkout -b backup commit

  • Git     push,merge,pull,fetch,rebase各自在什么情况下使用

出现error: The following untracked working tree files would beoverwritten by checkout: 时可以用
Git clean -d -fx来解决

如果git pull的时候不想因为自己的更改而产生冲突,可以执行如下命令
gitstash
gitpull
gitstash pop

如何提交代码?
git stage 文件名
git commit -m "提交注释"
git push origin 远程分支

收藏
收藏0
分享
分享
点赞
点赞0
反对
反对0
hahaahhahaha!!123
回复

使用道具 举报

大神点评2

沙发#
Robby.zou 发表于:2016-9-28 10:51:18
该会员没有填写今日想说内容.
回复

使用道具 举报

板凳#
Robby.zou 发表于:2016-9-28 10:51:27
该会员没有填写今日想说内容.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册
手机版