On Thu, May 22, 2014 at 4:23 PM, Valerio Pachera <siri...@gmail.com> wrote:
> Hi, I'm a git beginner.
> I have a github account.
> I created an empty repository and cloned it on my laptop.
> I added 2 files then
>
> git add file1 file2
> git commit -s
> git push
>
> Everything is fine.
> I made changed to the readme.md, file1 and file2.
>
> What I wish now is to commit *only* the changes I made to file1.
> The problem is that I run 'git commit -a' before.
> I tried to
>
> git rm --cached -r .
> git add file1
> git commit --amend
>
> but I get the message
>  4 files changed, 9 insertions(+), 918 deletions(-)
>
> It seems more that it tries to remove the files I've been un-tracking .
>
> I'm probably reasoning the wrong way.
>
> What do you suggest to do?

If you have `git commit -a` on changes and then change your mind about
what you did, then first realise that not all is lost!  What you want
is to rewrite history.  You should read about `git rebase -i`
carefully, ideally in more than one place and then proceed with
caution.  A good place to start with rebasing is
http://git-scm.com/book/en/Git-Branching-Rebasing

In this particular case though.  Since you have so little history to
deal with, it might just be easier to start over on a new repo
instead.  It depends on the nature of the changes you made...

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe               http://therning.org/magnus

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to