git - Confused how to revert all files as per master branch -
i created new branch (git branch working
) , switched branch (git checkout working
). added new files/folders , edited existing files.
now want how things before creating 'working' branch. ie: want remove new files/folders added, , undo changes made existing files.
i checked out master (checkout master
) nothing reverted how was. im misunderstanding here. if git status
while on 'master' branch get:
changes not staged commit: (use "git add/rm <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) here existing files edited untracked files: (use "git add <file>..." include in committed) here new files/folders added
i thought checking out master, revert before created 'working' branch. need @ point?
also, once i've reverted how in master,...what if wanted checkout 'working' again. new files/folders , changes there still? (ie: swap between master / working needed)
what need @ point?
you need checkout working branch, add changes there , commit them. 'registered' branch.
after can checkout master , in original state without changes.
it not work because have not committed changes, , changes in working directory not discarded when changing branches brought on master branch during checkout.
also, once i've reverted how in master,...what if wanted checkout 'working' again. new files/folders , changes there still?
yes, because commit changes on working branch.
Comments
Post a Comment