Created
March 26, 2012 11:05
-
-
Save catchamonkey/2204457 to your computer and use it in GitHub Desktop.
A git problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A git problem. | |
I Created and checked out a new branch called 'feature' | |
I created files, worked on them, committed changes and pushed upstream. | |
I Carried on working on the new files, made further changes, then thought these additional changes should belong in a different feature. | |
While on the 'feature' branch I ran git checkout -b sub_feature master | |
Oops, I really should have just created this branch based on my current 'feature' branch as it's a sub feature and therefore dependent on it. | |
So I then ran another wrong command, git reset . to reset my tree back to the known state, unfortunately that was of course the state of master, not my actual 'feature' like I wanted. | |
So I thought, hey I'll just checkout the 'feature' again, then start from there. But of course it won't let me as I have untracked files that already exist in the branch I want to checkout. | |
So now I'm on master and I have the following; | |
git status: | |
# On branch master | |
# Untracked files: | |
# (use "git add <file>..." to include in what will be committed) | |
# | |
# feature/Folder/ | |
# lib/singleFile.php | |
nothing added to commit but untracked files present (use "git add" to track) | |
And the state of these files is of course fresh, as they were new in the 'feature' branch they do not exist in the master. | |
What I would like is to get back to the state of the last commit in my 'feature' branch, but without losing the work I have done for 'sub_feature' which I haven't committed anywhere yet. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment