mdundas
mdundas

Reputation: 799

Git: i forgot to branch

I'm new to Git, and not sure how to proceed with this. Here's my use case:

I had a stable version of the code, all checked in on my desktop and pushed to my remote repo. Then i did a pull from the remote repo to my laptop and added features and destabilized the code. ( but i didn't do a branch first ).

Now i'm back on my desktop. I like the snapshot i have here. I want to tag it version 1.0. But i'm out of sync with the remote repo. What steps would you guys recommend? The snapshot on my laptop is important too obviously but not yet stable.

thx, matt

Upvotes: 2

Views: 769

Answers (3)

Grady Player
Grady Player

Reputation: 14549

you can make a branch of an arbitrary patchset.

git branch someBranch 46744feg

Upvotes: 0

SzG
SzG

Reputation: 12629

Create a branch where you are, but stay on master:

git branch my-cool-feature

Then reset master to the state on the remote:

git reset --hard origin/master

Finally put a tag on you feature branch:

git tag 1.0 my-cool-feature

Upvotes: 10

Noufal Ibrahim
Noufal Ibrahim

Reputation: 72845

Tag the current HEAD on your desktop and then pull from the remote repository. Then push the tags back. What's the problem with that? The situation will be

A - B - C - D(v1.0) - E - F (master)

where E and F are unstable changes that you made on your laptop and pushed back to the remote repository.

Upvotes: 2

Related Questions