2

I come from the SVN world so I might not get all the slight concept differences in GIT.

I have a origin/master branch. I have been tagging the master for a while. Then something that happened in production. A nasty bug that we need to fix.

So, I diligently switched (checkout) to a tag (let's call it prod-1.0). Then I created a branch. I modified my code, commited in origin/prod-1.0-hotfix. I then proceeded to push that branch to my remote.

Now a new bug was found in prod. I thought I could just checkout the branch 'prod-1.0-hotfix' but it turns out, it's not the code from 'prod-1.0-hotfix' but the code that was in origin/master at the time I pushed the branch to remote.

Can someone shed a light?

code-gijoe
  • 6,949
  • 14
  • 67
  • 103

1 Answers1

2

Branching off a tag will use the branch the tag is currently on. https://stackoverflow.com/a/5582368/1354978

https://stackoverflow.com/a/792027/1354978 This comment on that post says it all.

Yep. git is different to subversion in this respect. A svn tag basically copies the files to a new folder, so you can svn checkout a specific bunch of files, whereas git tags are simply pointers to specific revisions. – dbr Apr 27 '09 at 2:17

I think what you should do is... Branch off master to prod-1.0-hotfix

git reset -—hard  prod-1.0 bad_tag_tag_name
git push origin prod-1.0-hotfix 

That would create a remote branch with the HEAD @ prod-1.0-hotfix

I love this site gitready.com http://gitready.com/advanced/2009/02/16/convert-git-svn-tag-branches-to-real-tags.html

Thnx and +1 to Erik Petersen, and dbr for help on that one.

Community
  • 1
  • 1
earlonrails
  • 4,966
  • 3
  • 32
  • 47