git命令

---------------基本命令


远程拉取代码
git clone ssh://lix@10.168.4.181:29418/daoshu_jg_page.git


提交:
git add [file1] [...]

git status

git diff

git commit -m 'comment'

推送:

git fetch origin [branch]

git rebase

此时若有冲突,手动处理
git add [conflict file]

git rebase --continue

git push origin [branch]


日志
git log --oneline

git log
退出命令:按q退出


删除
git rm <file>

git rm -f <file> 已放入缓存

git mv [old] [new]



git pull = git fetch & git merge

打开文件  C:\Users\ds-dbr\.gitconfig 添加以下配置
[branch]
    autosetuprebase = always

这时:
git pull = git fetch & rebase
    
    

将lixin分支合并到dev分支

git checkout dev
git merge lixin


----------------进阶命令

一、把修改暂存起来,留着以后使用
git stash [save "comment"]
 
查看暂存进度
git stash list

恢复进度    
git stash pop [--index]


二、撤销工作区的修改
git checkout -- b.txt


三、缓存区的改动撤回到工作区
git reset HEAD a.txt


四、最近的一次commit撤回到暂存区
git reset --soft HEAD^


五、回退已经push到远程版本库的提交
git revert HEAD


补充几个git懒人操作常规命令  如下:
git config --global alias.br  branch   git branch   ===>  git  br
git config --global alias.co  checkout  git checkout  ===>  git co
git config --global alias.ci commit git commit ===> git ci
git config --global alias.st  status git status ===> git st

posted on 2018-10-10 15:18  蚂蚁之想  阅读(129)  评论(0编辑  收藏  举报

导航