:: Re: [DNG] Ho do I remove added file…
Forside
Slet denne besked
Besvar denne besked
Skribent: ibid.ag
Dato:  
Til: Edward Bartolo
CC: dng
Emne: Re: [DNG] Ho do I remove added files using git?
On Sat, Sep 19, 2015 at 07:17:23PM +0200, Edward Bartolo wrote:
> Hi all,
>
> I messed up git. Please somebody intervene to help.
>
> This is the 'git status' output and it is ugly!
> ----------------------
>
>
> $ git status
> On branch master
> Your branch and 'origin/master' have diverged,
> and have 2 and 3 different commits each, respectively.
> (use "git pull" to merge the remote branch into yours)
> You have unmerged paths.
> (fix conflicts and run "git commit")
>
> Changes to be committed:
>
>     new file:   backend_src/src/automated_scanner.13.09.2015.c
>     new file:   backend_src/src/automated_scanner.gslist.c
>     new file:   backend_src/src/backend
>     modified:   backend_src/src/caller.c
>     new file:   backend_src/src/core_functions.backup.c

>
> Unmerged paths:
> (use "git add <file>..." to mark resolution)
>
>     both modified:   backend_src/src/automated_scanner.c

>

[snip]
> I want to get rid of those 'new' files and the 'modified' file.


If you mean that you want to *delete* the "both modified" one, use
"git rm $FILE"
(you may need to add a -f).
Then run "git commit".
Then delete any remaining files that you want to remove, and run "git
commit" again.

However, the approach you usually want is to edit that file, search for
<<<<<< [commit info]
...
====== [commit info]
...
>>>>>>


and choose which side of the ====== to keep.

Then you will run
$ git add $FILE
$ git commit


HTH,
Isaac