Julien Vehent on 25 Oct 2012 09:11:07 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] git-fu


On 2012-10-25 12:04, Eric at Lucii.org wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My limited git skills are proving to be insufficient today.

Background: I made some code changes and committed them.
I subsequently made more changes but now I'm thinking I
/may/ have gone down the wrong path.

I'd like to go back to the last commit, create a branch,
and try another approach in that branch.  How can I do
that without losing the current changes in the event I
want to come back to them?

Presumably, if the new branch works then I'd merge it into
master (and then I don't care about what happens to the
current changes.)

I suspect tmtowtdi.


`git revert` will take you back to a previous commit, by creating a 'revert' commit that revert your changes.

You can then revert the revert to get back your changes.

I would:
1. revert
2. create a new branch
3. go back to master and either merge the new branch in, or revert the revert


- Julien
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug