Zulip Chat Archive

Stream: mathlib4

Topic: Remove a file from PR


Arien Malec (Jan 22 2023 at 02:27):

What's the git-fu to remove lake-manifest.json from a PR?

I tried git checkout origin/master -- lake-manifest.json, then commit and push, but the changes are still in the PR...

Yakov Pechersky (Jan 22 2023 at 04:48):

Did you git add the modified/checked out file, before committing?

Shreyas Srinivas (Jan 22 2023 at 13:35):

git rm --cached ....

Arien Malec (Jan 22 2023 at 16:13):

Doesn’t that remove it from both?

Arien Malec (Jan 22 2023 at 16:41):

Actually that removes it from the index. But I just want upstream’s version and want to forget the (committed) changes it’s tracking.

Shreyas Srinivas (Jan 22 2023 at 17:01):

then you checkout the file from the preceding commit and add it and commit it

Shreyas Srinivas (Jan 22 2023 at 17:02):

git checkout <commit_id> <file_name>

Shreyas Srinivas (Jan 22 2023 at 17:17):

You presumably don't want the file to be tracked after that either. So applying git rm --cached will make sure that it is not tracked any further.

Arien Malec (Jan 22 2023 at 19:59):

Nope, now the PR wants to delete lake-manifest.json

Arien Malec (Jan 22 2023 at 20:05):

So here's the current situation:

the file change was tracked (inadvertently I think) when master was merged:

7584bce8 (HEAD -> port/Data.Seq.Computation, origin/port/Data.Seq.Computation) stop tracking lake-manifest.json
a069e055 removed modified lake-manifest from PR
3284f097 Merge remote-tracking branch 'origin/master' into port/Data.Seq.Computation

Arien Malec (Jan 22 2023 at 20:06):

now, I just rolled back to that commit...

7c416efe (HEAD -> port/Data.Seq.Computation, origin/port/Data.Seq.Computation) roll back lake-manifest
7584bce8 stop tracking lake-manifest.json
a069e055 removed modified lake-manifest from PR

Arien Malec (Jan 22 2023 at 20:07):

But what I really want to do is roll back the commit ID that modified it in the first place.

Kevin Buzzard (Jan 22 2023 at 21:48):

Why don't you just edit the file to what it is supposed to be and then push it? Is there a reason that you want to make it more complicated?

Arien Malec (Jan 22 2023 at 22:26):

It’s going to apply whatever is there when it merges. But yeah, once it’s approved someone with commit rights to master can checkout the latest then merge the PR and it will be a noop

Yaël Dillies (Jan 22 2023 at 22:33):

No it won't, right? We squash-merge PRs.

Eric Wieser (Jan 22 2023 at 22:50):

It would help a lot if you mentioned the relevant PR number so that we could actually see the git history you are talking about

Arien Malec (Jan 23 2023 at 00:48):

Mathlib4#1216

Eric Wieser (Jan 23 2023 at 00:58):

Is your comment there a note to self? Kevin's suggestion will work fine here; if you didn't intend to edit that file at all, then just replace its content with what master has and commit it.

Arien Malec (Jan 23 2023 at 01:06):

I did & the file was still there.

Arien Malec (Jan 23 2023 at 01:06):

That was the step in top of the thread.

Arien Malec (Jan 23 2023 at 01:07):

This change came along with the merge of master into this branch

Arien Malec (Jan 23 2023 at 01:10):

That’s why I think the solution here is to do that prior to merge.

Shreyas Srinivas (Jan 23 2023 at 11:57):

The simplest solution is @Kevin's. Checkout the file from an earlier version, add, and commit

Shreyas Srinivas (Jan 23 2023 at 11:57):

If you want an earlier version of the file


Last updated: Dec 20 2023 at 11:08 UTC