Git使用

作者: ToFlyBear | 来源:发表于2017-10-20 14:57 被阅读0次

http://www.ruanyifeng.com/blog/2014/06/git_remote.html

http://nvie.com/posts/a-successful-git-branching-model/

http://insights.thoughtworkers.org/gitflow-consider-harmful/

git 基本命令
http://www.cnblogs.com/cspku/articles/Git_cmds.html
http://www.ruanyifeng.com/blog/2015/12/git-cheat-sheet.html
fetch 是从remote取到repo,不会自动合并改动
pull 是从remote 取到当前branch , 合并改动

repo init
repo init -u ssh://<USERNAME>@IP:PORT/<PATH_TO_MANIFEST_PROJECT> -b <MANIFEST_REVISION> -m <MANIFEST_NAME>

repo sync

$ repo sync or
$ repo sync [<PROJECT_LIST>]

创建新分支:git branch branchName
切换到新分支:git checkout branchName
上面两个命令也可以合成为一个命令:
git checkout -b branchName

git checkout master //取出master版本的head。
git checkout tag_name //在当前分支上 取出 tag_name 的版本
git checkout master file_name //放弃当前对文件file_name的修改
git checkout commit_id file_name //取文件file_name的 在commit_id是的版本。commit_id为 git commit 时的sha值。
git checkout -b dev/1.5.4 origin/dev/1.5.4 //从远程dev/1.5.4分支取得到本地分支/dev/1.5.4

新建一个分支,与指定的远程分支建立追踪关系

$ git branch --track [branch] [remote-branch] 这个意思是建立branch之间关系 一般git branch前提是你在一个branch上 再建branch就是基于当前branch, 加上--track就可以改变新branch 基于的branch位置

branch view
git branch -av
branch delete
git branch -d <BRANCH_NAME> //-D 直接删 -d 会check 是否又改动

git pull rebase XXX(remote branch) 解决是 当前branch commit后 remote又有commit,
通过pull + rebase 将remote commit 和当前branch commit 合并起来
= git fetch then git rebase XXX

git checkout -b [your branch name] --track [remote branch name]

git push [remote name] HEAD: [branch_name]
git push [remote name] HEAD:refs/for/[branch_name]

相关文章

  • Git常规使用

    Git怎么使用?使用 git commit 进行提交操作时,Git都做了什么? Git怎么使用? 下载、安装Git...

  • AD 使用 Git 的注意事项

    使用 Git 管理项目 Altium Designer 支持使用 Git/SVN 用以版本控制。如果使用 Git,...

  • git

    使用git add . 代替 git add *使用git add之后,怎样恢复?

  • GIT和Github

    #Git的初识 ##Git 的使用 Git 使用初尝试 新建项目来操作 克隆已有项目来操作 Git 的使用 by ...

  • git代理配置

    git http 使用 http proxy git http 使用 https proxy git http 使...

  • Git命令使用

    Git命令使用 前言在使用Git命令之前都使用可视化工具SourceTree操作git,现在需要Git Andro...

  • 前端学习路线(2)——Git使用、DIV+CSS布局

    Git使用、DIV+CSS布局 1. Git使用 链接:git下载链接:git for windows(下载速度可...

  • vscode操作git总让输入用户名密码

    clone使用git地址,不要使用https地址修改.git/config文件中的url = git@git.pl...

  • git 操作以及submodule模式详解,附加jenkins对

    git常用命令 注意:请确保已经安装里git客户端 git使用帮助 git --help //git使用帮助,可...

  • git

    *** git checkout 也可以直接 reset ***使用Git进行项目存储使用git pull时,项目...

网友评论

      本文标题:Git使用

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