Can I save the changes of my some old commit, gotten via `git checkout`? -


i learning git , reading this.

you can use git checkout view “make import changes hello.py” commit follows:

git checkout a1e8fb5

this makes working directory match exact state of a1e8fb5 commit. can @ files, compile project, run tests, , edit files without worrying losing current state of project. nothing in here saved in repository. continue developing, need “current” state of project:

git checkout master

but @ case lost current changes in working directory... if experiment successfull , want save result also? i.e. can save changes of old commit, gotten via git checkout?

git checkout <commit-id> -b foo 

explanation

foo : can name of backup branch want place checkout commmit.

commit-id : , commit checkout.

result

your checkout changes stored in foo local , no worries. if want persist changes made you'll have use git commit; these commits stay on foo can reference them @ time.


Comments