git常用

git常用命令

1)

    git add a.txt   
    git status
--------------------------------------------------------------
    On branch master
    Changes to be commited:
        (use "git reset HEAD <file>... to unstage)
            new file:     a.txt
    git reset HEAD a.txt    

    git status
--------------------------------------------------------------
    On branch master
    Untracked files:
     (use "git add <file>..." to include in what will be commited)
        a.txt
     nothing added to commit bug untracked files present (use "git add" to track)

2、冲突解决

<<<<<<< HEAD
	#要提交的内容
=======
        #下拉的内容
">>>>>>> e59ca5b2fd1b72d8111a2994ddd5dc1a6fbdc2ea"

3、git branch

git branch -v
git branch -a 显示所有分支
git branch -r 显示远程分支
git checkout -b xxx origin/xxx 切换到xxx分支
git checkout master 切换到master分支

4、git log

git log --pretty=oneline
git log --online
git reflog 可以使用{HEAD~n}操作

5、git merge

6、

git commit   --amend        撤销上一次提交  并讲暂存区文件重新提交
git checkout -- <file>     拉取暂存区文件 并将其替换成工作区文件
git reset HEAD  -- <file>  拉取最近一次提交到版本库的文件到暂存区  改操作不影响工作区
posted @ 2019-04-24 12:52  xidianzxm  阅读(123)  评论(0编辑  收藏  举报