1

So I was trying to reverse the first "Create .gitignore" immediately above remotes/upstream/master IT..... didn't go well..... remotes/origin/master is where Github was at

I Fucked up.....

Eventually I did successfully get my local master back to where I wanted to be by going git reset --hard SHAforRemote/upstream/master git cherry-pick SHAforCorrect.gitignore git cherry-pick SHAforCorrectChangeGet-MSOLUser

Which got me to the place shown above. I got Github at the correct place by doing git push -f origin master which now has me at Progress! WHOO! Local and remote master are current with each other! Basically all of these but the last one Loads of annoying references Anyone know if/how I can remove the Commits these mentions are referencing?

I have been searching a a few places mentioned Git's garbage collection will remove it over time, but that might have just been local/git repo I run not something like GitHub. Any ideas? Basically I think I a looking to remove these in the pink, but I'm slightly concerned because things like the blue arrows are all basically the same Commit.... or reverting that commit because I was stupid enter image description here

Anything I can do to get rid of that pink junk on the right? PS, as far as I know how, I can't find those commits anywhere in GitHub except through those mentions on that issue. The actual list of Commits in the Repo doesn't show them anymore.... Maybe the GC will remove them from GitHub after a while? enter image description here

PsychoData
  • 1,198
  • 16
  • 32
  • It sounds like your best bet is probably [git squash](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html). EXAMPLE: `git rebase -i HEAD~4` – paulsm4 Dec 17 '18 at 04:50
  • I mean, Github and my local are where I want them, I just want to see if I can git rid of the junk tree part in pink that I am not on anymore, mostly so that the mentions on Github won't take people to the old, disconnected-from-live, commits where I had built myself a crappy tree – PsychoData Dec 17 '18 at 04:54
  • If it were me, based on your description, I'd try "git squash" first. I've not tried "git fetch --prune" before, but it certainly sounds promising. Worst case, you could always re-create your project from scratch locally, nuke the version on GitHub, then "git push --all" your New Improved project back to GitHub :) – paulsm4 Dec 17 '18 at 06:27

1 Answers1

2

I just want to see if I can git rid of the junk tree part in pink that I am not on anymore

Make sure the branch is deleted on GitHub side, then do a prune:

git fetch --prune

That should at least take care of the remotes/origin/xxx branch.


Or, as noted in the comments by alper, using Git 1.8.5 (Q4 2013) or more recent:

git config --global fetch.prune true
git fetch --all
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250