:: Re: [DNG] Ho do I remove added file…
Pàgina inicial
Delete this message
Reply to this message
Autor: ibid.ag
Data:  
A: Edward Bartolo
CC: dng
Assumpte: Re: [DNG] Ho do I remove added files using git?
On Sat, Sep 19, 2015 at 05:53:59PM +0200, Edward Bartolo wrote:
> Hi,
>
> I added two useless files to netman that I want to remove: these are
> netman.lpi and netman.lps.
>
> What should I do? git is rejecting my changes like this:
> $ git pull
> error: Your local changes to the following files would be overwritten by merge:
>     netman.lpi
>     netman.lps
> Please, commit your changes or stash them before you can merge.
> Aborting


Assuming that you want to completely obliterate them, *I* would do this:
$ git diff -- netman.lpi netman.lps | patch -p1 -R
$ git pull
$ git rm netman.lpi netman.lps
$ git commit

The first step can also be done with
$ git reset --hard -- $FILES
or
$ git checkout $COMMIT -- $FILES
>
> I want to also delete my latest two git commits to the repository if
> that is possible.


If you haven't pushed them, you can use git rebase --interactive:
$ git rebase --interactive HEAD^^^
and delete the lines referring to them.

NOTE that they'll be completely gone if you do this.
If you don't want to do that, or you have pushed them, use "git revert".

Any use of git rebase --interactive should be before you delete the
files.

HTH,
Isaac Dunham