Re: [petsc-dev] git help needed

2014-02-19 Thread Karl Rupp

Hi Barry,

I accidentally added and committed in master when I meant to do it 
in another branch.


~/Src/petsc/src/ts/examples/tutorials  master $ git add ex1s.c
~/Src/petsc/src/ts/examples/tutorials  master $ git commit -a
[master 8bd0fc5] adding SNESPSEUDO solver
  5 files changed, 449 insertions(+), 1 deletion(-)
  create mode 100644 src/ts/examples/tutorials/ex1s.c

How do I undo this so I can switch to another branch and do the commits into 
that?


If you haven't yet pushed this to remote, run
 git reset --soft HEAD^
to only undo the commit. ex1s.c will still include your changes and be 
scheduled ('staged') for the next commit. If you want to undo all your 
changes including ex1s.c, use

 git reset --hard HEAD^
instead.

Note that once you pushed your commits to the remote, you should not 
attempt to change these commits.


Best regards,
Karli



Re: [petsc-dev] git help needed

2014-02-18 Thread Svetlana Tkachenko
You can `git reset --soft previous item in git log`, I think, switch to 
another branch, and commit twice (once to master and once to that branch).

- Original message -
From: Barry Smith bsm...@mcs.anl.gov
To: petsc-dev petsc-dev@mcs.anl.gov, Karl Rupp r...@mcs.anl.gov
Subject: [petsc-dev] git help needed
Date: Tue, 18 Feb 2014 22:57:50 -0600


  I accidentally added and committed in master when I meant to do it in another 
branch. 

~/Src/petsc/src/ts/examples/tutorials  master $ git add ex1s.c
~/Src/petsc/src/ts/examples/tutorials  master $ git commit -a
[master 8bd0fc5] adding SNESPSEUDO solver
 5 files changed, 449 insertions(+), 1 deletion(-)
 create mode 100644 src/ts/examples/tutorials/ex1s.c

How do I undo this so I can switch to another branch and do the commits into 
that?

git revert help message is useless