git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: I messed up my own git tree and I don't know how to fix it.

From
Rrob <drrob100@fastmail.com>
Date
Apr 21, 2019, 12:34 UTC
Message-ID
<b0a8d228-78c5-a355-1ded-dc2904d8216e@fastmail.com>
In-Reply-To
<CAP_kE8XaFW=G1f_qrS2sEp+ELQ9otk=j0-ZtbF1dATQX8ZjrAA@mail.gmail.com>

didn't work.  I did not get any error messages, just didn't work.  After I did

   git reset --hard
   git status

I see the same 3 files that say changes not staged for commit: modified and it lists the same 3 files.

--rob
On 4/21/19 1:03 AM, Adrian H wrote:
Show 62 quoted lines
> If I understand the commands you are using correctly, you are
> referencing the remote repo.  You need to reference the local repo.
> So try using the following commands:
>
> git checkout -- alecthomas/gometalinter
> git checkout -- kisielk/errcheck
> git checkout -- rogpeppe/godef
>
> Or if those are the only files that have been modified, then you can
> use the following single command:
>
> git reset --hard
>
> and that will reset all files that have not been staged.
>
> HTH
>
>
> A
>
>
> On Sat, Apr 20, 2019 at 11:22 PM rob <drrob100@fastmail.com> wrote:
>> I have my own code at a github repository, using Go.  Part of using Go
>> libraries not part of the official Go people is by using a system they
>> call go get.  This essentially uses git to, well, go get source code.
>> Mine are at github.com and golang.org.  My computer runs LinuxMint 19.1.
>>
>> I used goland IDE from jetbrains to run go fmt on my entire project.
>> Now I am getting this message that I cannot get rid of:
>>
>> changes not staged for commit:
>>
>>     modified: github.com/alecthomas/gometalinter (modified content)
>>
>>     modified: github.com/kisielk/errcheck (modified content)
>>
>>     modified: github.com/rogpeppe/godef (modified content)
>>
>>
>> I do not want any changes to central repos to be tracked or committed,
>> but I cannot undo this.  I tried, for example,
>>
>> git checkout -- github.com/alecthomas/gometalinter
>>
>> I don't get an error message but it does not do anything.  The file is
>> not changes, and git status show me the same information, ie, these
>> files have changes not staged for commit.
>>
>> I do not know how to restore these files to the state they were in in
>> the repo, and to have my own git tree not to flag this as an unstaged
>> alteration.  Running rm -rfv on the repos on my computer, then running
>> go get to restore them does not change git status. It still sahs changes
>> not stated for commit: modified.
>>
>> This happens for the above 3 tree items.
>>
>> How do I restore these to the github remote repository condition and not
>> have my own git tree mark these as changed?
>>
>> --rob solomon
>>
>
Previous: Adrian HNext: Philip Oakley
Message 3 of 9 in “I messed up my own git tree and I don't know how to fix it.”
  1. robApr 21, 2019
  2. Adrian HApr 21, 2019
  3. robApr 21, 2019
  4. Philip OakleyApr 21, 2019
  5. robApr 21, 2019
  6. Philip OakleyApr 21, 2019
  7. robApr 21, 2019
  8. robApr 21, 2019
  9. Andreas SchwabApr 21, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.