赞
踩
当有人对master进行更新之后,你想让已经创建的分支内容更成master的最新状态,
bpan@5CG7022BM2 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) bpan@5CG7022BM2 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 bpan@5CG7022BM2 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 bpan@5CG7022BM2 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
这将把master分支最新的提交合并到目标分支中。如果出现冲突,需要手动解决冲突后再提交。
另外,如果只需要更新分支上的某个文件或文件夹,可以使用以下命令:
切换到目标分支:
git checkout 分支名
使用checkout命令将master分支上的文件或文件夹更新到目标分支:
git checkout master 文件路径
这将使用master分支上最新的版本替换目标分支上的文件或文件夹。
需要注意的是,使用以上命令后,需要手动提交更改到目标分支,使用以下命令提交更改:
git add . “存放暂存区”
git commit -m "update" “存放本地库”
git push origin lijia “更新master分支内容到分支”
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。