简体   繁体   English

如何在 git 中同步分支

[英]How to sync branches in git

Please excuse my knowledge with Git as I'm new to GitHub world.请原谅我对 Git 的了解,因为我是 GitHub 世界的新手。 I have 4 branches namely master, release, develop and staging.我有 4 个分支,即master, release, develop and staging. At this point all branches are in sync, and the I made some changes to the code and pushed from staging -> develop此时所有分支都已同步,并且我对代码进行了一些更改并从staging -> develop推送

Now I realise that I need to revert those changes and they should be same as release branch.现在我意识到我需要恢复这些更改,它们应该与release分支相同。 I'm not sure how to do that, because when I try to do that from GitHub page it says 'There isn't anything to compare' whereas I can see the difference in files.我不知道该怎么做,因为当我尝试从 GitHub 页面执行此操作时,它会显示“没有可比较的内容”,而我可以看到文件中的差异。

Could someone please assist as how to synch the staging and develop with release branch.有人可以协助如何同步stagingdevelop与发布分支。

Git branches are not typically used to set up different build environments. Git 分支通常不用于设置不同的构建环境。 The main purpose of a branch is to house functionality that is being worked on separate from the master branch.分支的主要目的是容纳独立于主分支的功能。 Eventually this functionality would be merged into master, with its source branch deleted.最终此功能将合并到 master 中,并删除其源分支。 As such, it doesn't make a lot of sense to have every branch "synced" (which I assume means they are the same).因此,让每个分支“同步”并没有多大意义(我认为这意味着它们是相同的)。 If you want to house different build environments, and update them as needed, you need to look into something called DevOps.如果你想容纳不同的构建环境,并根据需要更新它们,你需要研究一种叫做 DevOps 的东西。 It's a related but separate concept that I highly recommend you look into after getting a grasp of the Github basics.这是一个相关但独立的概念,我强烈建议您在掌握 Github 基础知识后研究一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM