首页 > 解决方案 > 以什么顺序执行 git 命令以从暂存中提取更改、与功能合并并推送到远程?

问题描述

我有一个名为的功能分支feature和一个名为的暂存分支,staging.如何在推送到 Github之前获取最新更新staging并将其合并到?featurefeature

标签: gitgithubstaging

解决方案


我会运行类似的东西:

git fetch --all       (update your git's knowledge of remote stuff)
git checkout feature  ('tags' your folder as code belonging to feature branch and downloading the code)
git pull origin staging  (downloads staging code and but keeps it as code belonging to feature branch)
git add .            (marks all code changes for commit)
git commit -m'my awesome code changes' ( commits)
git push origin feature  (Pushing all your changes to feature branch)

好吧,拉后你很可能需要解决所有冲突。但这超出了范围:)

但是在运行来自互联网的人的任何命令之前......做一个保留副本:)


推荐阅读