在Git中实现“浮动标签”最常用的方式是什么? [英] What’s the most idiomatic way to implement a “floating tag” in Git?
问题描述
我将我的网站保存在Git存储库中。这只是一个小型的个人网站,所以没有花哨的自动化;我将进行一系列更改,然后定期使用 jekyll-s3 将网站推送到服务器。我喜欢跟踪哪些修订已上传,哪些尚未上传,现在我有一个名为推送
的分支,我将合并到<大师
每次我上传到服务器。 (如果涉及任何其他分支,我会在推送前将所有内容合并到 master
中,以便只有 master
合并到 push
。)
这个效果不错,但是当我使用整个我所关心的只是一次标注一次提交,因为这已被推送。 (是的,我知道分支在Git中被认为是非常轻量级的。)术语方面,似乎我想在每次上传到服务器时都标记最新的提交 - 除了在Git中,标签应该是对一个特定提交的不可变引用。保持一个名为推动
的分支是我尝试做的最习惯的方式,还是有更好的方式?
如果我理解正确,您想要参考网站上的最新更新,对吗?那么,分支事实上就是他们所做的事情,但与您所做的命名不同。
您可能知道,版本控制系统有两种主要的开发方式: 你说的实际上是第二种方法,你有一个名为 所以,是的,你已经存在了,但是更习惯地说,它们保持 编辑:我在说的是,只要您想将更改上传到您的网站,合并无论你在 I keep my website in a Git repository. It’s just a small personal site so there’s no fancy automation; I’ll make a bunch of changes and then periodically push the site to the server using jekyll-s3. I do like to keep track of which revisions have been uploaded and which haven’t, and right now I have a branch called This works well enough, but it seems weird to me to be using an "entire" branch when all I care about is marking one commit at a time as "this has been pushed". (Yes, I know that branches are considered very lightweight in Git.) Terminology-wise it seems like I want to "tag" the latest commit each time I upload to the server—except that in Git, a tag is supposed to be an immutable reference to one specific commit. Is keeping a branch called If I understood correctly, you want to have a reference to your last update on the website, right? Well, branching is in fact what they do, but not with the naming you have done. As you may know, there are two major ways for development with version control systems: What you are talking about is in fact the second method, where you have a stable branch named So, yeah what you do already exists, however more idiomatically, they keep Edit: What I'm saying is that, whenever you want to upload your changes to your website, merge whatever you have in 这篇关于在Git中实现“浮动标签”最常用的方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
master
是开发分支。在这种情况下,stable版本是特定的标签。
master
是稳定的分支。在这种情况下,你有其他分支机构进行开发。当你想把你的特性添加到 master
时,你将master与你自己的分支合并并测试它。如果有效,您将结果与 master
合并并推送到您的网站。 推动
的稳定分支,并保持稳定(上传,工作,你想要的任何属性)
master
为该稳定的分支而不是其他分支(例如,命名为 push
)。这是相同的概念。
master
(或者推动
如果你喜欢的话)中都有,然后上传它。这样, master
(或pushed
into which I merge master
each time I upload to the server. (If any other branches are involved I merge everything into master
before pushing, so that only master
ever gets merged into pushed
.)pushed
the most idiomatic way to do what I’m trying to do, or is there a better way?
master
is development branch. In this case, the stable releases are certain tags.master
is the stable branch. In this case, you have other branches for development. When you want to add your feature to master
, you merge master with your own branch and test it. If it worked, you merge the results with master
and push it to your website.pushed
and you keep it stable (uploaded, working, whatever property you want) at all times.master
as that stable branch rather than some other branch (for example named pushed
). It's the same concept though.master
(or pushed
if you like), and then upload it. This way, the last commit of master
(or pushed
) is the last upload of the website.