Git 如何把master的内容更新到分支

Posted 潘彬

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Git 如何把master的内容更新到分支相关的知识,希望对你有一定的参考价值。

Background:

  当有人对master进行更新之后,你想让已经创建的分支内容更新到master的最新状态,

[email protected] MINGW64 /d/GitRep/JIRA_Extensions (master)
$ git checkout 20180315  //切换到分支下
Switched to branch 20180315
Your branch is behind origin/master by 17 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

[email protected] MINGW64 /d/GitRep/JIRA_Extensions (20180315)
$ git merge master  //合并master到分支,
Updating cee69ca..8b0ec9a
Fast-forward
 .gitignore                                         |   2 +
 .../functions/ExtractGroupMembersToExcelFile.java  | 225 +++++++++++++++++++++
 2 files changed, 227 insertions(+)
 create mode 100644 src/main/java/com/nokia/jira/functions/ExtractGroupMembersToExcelFile.java

[email protected] MINGW64 /d/GitRep/JIRA_Extensions (20180315)
$ git status
On branch 20180315
Your branch is up-to-date with origin/master.
nothing to commit, working tree clean

[email protected] MINGW64 /d/GitRep/JIRA_Extensions (20180315)
$ git push origin 20180315  //push到远程分支
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
Username for https://github.com: 962720900
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/962720900/JiraExtensionFunctions.git
   e713274..8b0ec9a  20180315 -> 20180315

 

以上是关于Git 如何把master的内容更新到分支的主要内容,如果未能解决你的问题,请参考以下文章

git如何把master代码合并覆盖到自己的分支?

Git-更新本地代码

Git 更新分支到 master

GitGit 分支管理 ( 克隆远程分支 | 克隆 master 分支 git clone | 查看远程分支 git branch -a | 克隆远程分支 git checkout -b )(代码片段

GitGit 分支管理 ( 克隆远程分支 | 克隆 master 分支 git clone | 查看远程分支 git branch -a | 克隆远程分支 git checkout -b )(代码片段

git clone