简体   繁体   English

在远程和分支本地版本上标记先前的git commit

[英]Tagging a previous git commit on remote and branching local version

Here's the situation: 情况如下:

  1. I previously committed code to the remote repository (master version) 我以前将代码提交到了远程存储库(主版本)
  2. I've since made changes to the local version but have not committed 此后,我对本地版本进行了更改,但尚未提交
  3. I would like to tag the remote version with a version number, branch the and tag local (uncommitted) version as dev or something like that before committing 我想用版本号标记远程版本,分支并标记本地(未提交)版本为dev或类似的东西,然后再提交

How might I go about doing this? 我该怎么做呢?

simply do it: 简单地做到这一点:

$ git status .
[...]
#    modified:  README.txt
[...]

# the following will create a tag on the last commit 
#  (the one already pushed to the remote)
$ git tag -a "v0.12" -m "version 0.12"

# send the tag to the remote
$ git push --tags

# create a new branch 'dev' and immediately switch to it
$ git checkout -b "dev"

# commit the modified files to the new branch
$ git commit -m "updated README for new 'dev'-version" README.txt

# push the new branch to the remote
$ git push

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

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