git

作者: tgw_wzu | 来源:发表于2017-06-02 11:46 被阅读0次

    常用git命令清单

    git status

    git add –A/git add *

    git commit –m"[提交信息]"

    git push origin [远程分支]

    git remote -v显示项目目前的远程仓库

    git remote add origin 新地址(新增远程仓库)

    git remote set-url origin新地址修改远程仓库地址

    版本控制

    git reflog找到以前提交的日志找到commitid

    git reset --hard [commit_id]回滚

    分支

    git branch -a//查看所有分支,包括远程

    git checkout –b dev =git branch dev git checkout dev

    冲突

    当git merge [分支]发生冲突时,修改源文件 然后再进行add/commit

    http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001375840202368c74be33fbd884e71b570f2cc3c0d1dcf000

    用带参数的git log也可以看到分支的合并情况:

    $ git log --graph --pretty=oneline --abbrev-commit

    多人协作

    因此,多人协作的工作模式通常是这样:

    首先,可以试图用git push origin branch-name推送自己的修改;

    如果推送失败,则因为远程分支比你的本地更新,需要先用git pull试图合并;

    如果合并有冲突,则解决冲突,并在本地提交;

    没有冲突或者解决掉冲突后,再用git push origin branch-name推送就能成功!

    如果git pull提示“no tracking information”,则说明本地分支和远程分支的链接关系没有创建,用命令git branch --set-upstream branch-name origin/branch-name。

    http://www.bootcss.com/p/git-guide/

    https://git-scm.com/book/zh/v2/

    Git忽略规则和.gitignore规则不生效的解决办法

    http://www.jianshu.com/p/1fba30981ee9

    相关文章

      网友评论

          本文标题:git

          本文链接:https://www.haomeiwen.com/subject/brayfxtx.html