I screwed up the repo

A place to discus the development of leJOS for the EV3. Please do not use this section to post questions about how to use leJOS or to report problems etc.
mcrosbie
Novice
Posts: 38
Joined: Wed Mar 24, 2010 12:27 pm
Location: Dublin, Ireland
Contact:

I screwed up the repo

Postby mcrosbie » Sun Nov 29, 2015 5:50 pm

All - I messed up! I inadvertently pushed a change in my local repo that was rw linked to the main github leJOS repo without me realising it. In doing so I've deleted the files from the remote repo. Sorry - total screw up on my end! I didn't think I had rw access to the main leJOS Code repo.

The last clean commit is here https://sourceforge.net/p/lejos/ev3/code/ci/56d9f41d6587bbb8dafe69f01e256371833b891c/ by Aswin 5 days ago. Can we roll back to that point to restore the files?

Mark
Last edited by mcrosbie on Sun Nov 29, 2015 6:36 pm, edited 1 time in total.

mcrosbie
Novice
Posts: 38
Joined: Wed Mar 24, 2010 12:27 pm
Location: Dublin, Ireland
Contact:

Re: I screwed up the repo

Postby mcrosbie » Sun Nov 29, 2015 6:00 pm

Ok I think I fixed it: I checked out the last good commit by Aswin at 56d9f41 and then rewound my local git repo to have that as the origin, and then pushed that back into the master remote repo as a new checkin. So if everything worked then I've undone the damage I caused.

Very sorry! :oops:

User avatar
gloomyandy
leJOS Team Member
Posts: 6047
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: I screwed up the repo

Postby gloomyandy » Sun Nov 29, 2015 6:38 pm

Hi Mark,
I think it all looks ok! I'm still trying to get my head around git, so could you explain what it was you were trying to do? I thought that push was used to update a remote repo and wasn't normally used for your local one?

Andy
leJOS news https://lejosnews.wordpress.com/

mcrosbie
Novice
Posts: 38
Joined: Wed Mar 24, 2010 12:27 pm
Location: Dublin, Ireland
Contact:

Re: I screwed up the repo

Postby mcrosbie » Sun Nov 29, 2015 6:51 pm

Hi Andy,

I've blown my foot off metaphorically with git more times than I care to recount.

I had a repo that consisted of my personal projects and the lejos-ev3-code repo in one place on my local PC which meant they were also merged in my personal github account. Things were getting messy, as the lejos-ev3 classes and other folders were now in my personal github account, and I decided to delete them. What I didn't realise at the time was that the local repo had a remote set to two different remote repos; one on github for my personal projects, and a second that pointed to the master lejos-ev3 repo. So when I git rm a whole bunch of directories and then did a git push, what it did was delete the files out of the master lejos repo on github, and not my personal repo. Ouch!

How did I fix it? The instructions are here: http://stackoverflow.com/questions/4114095/revert-git-repo-to-a-previous-commit I did the following steps:

Code: Select all

git checkout 56d9f4
git reset 56d9f4
git reset --soft HEAD@{1}
git commit -m "Revert to commit 56d9f4"
git reset --hard
git push origin HEAD:master


What that did was check out Aswin's commit 56d9f4, reset the HEAD in my local repo to point to it as the new head, committed the changes locally as a new commit and then pushed those changes upstream to the repo.

You'll see a few noisy commit messages on everything from me, but then all of the past version history is there.

Best reading on git I've found so far is this book: http://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes

Alternatively you can try your luck on these randomly generated git manpages which are practically indistinguishable from the real thing: http://git-man-page-generator.lokaltog.net/

Mark

unroller
Novice
Posts: 56
Joined: Sat Sep 25, 2010 6:10 am

Re: I screwed up the repo

Postby unroller » Sun Nov 29, 2015 10:39 pm

Hi Mark,

do you have permission to perform "force push"? In this case the repo can be restored in the initial state.

Code: Select all

git reset --hard 56d9f4
git push -f origin master


Return to “leJOS EV3 Development”

Who is online

Users browsing this forum: No registered users and 1 guest