gulfofmaine / sdm_workflow

A repository to help streamline the species distribution model development and prediction workflow.
MIT License
2 stars 0 forks source link

Commit question #62

Closed dzaugis closed 2 years ago

dzaugis commented 2 years ago

I was messing around with some stuff and my branch is now 2 commits ahead of the origin (gulfofmaine:main). I do not want to push these changes but rather just fetch upstream to revert the changes. I can't do that b/c github says my brach is not behind gulfofmaine:main and so there is nothing to pull upstream. How do I just toss out these commits to get back to even with the upstream branch?

aallyn commented 2 years ago

Hmmm...way above my head here. But, if you check out your forked:cloned copy of gulfofmaine/sdm_workflow:main and then do a pull upstream, then you've got your fork up to date with the gulfofmaine/sdm_workflow:main. You could then just delete your branch if there is really nothing that you want to use from it? If there is work on your branch that you want to keep, then I think you could merge....merge your gulfofmaine/sdm_workflow:main into your branch? Only other thing related I can think of is if you just wanted to revert commits, you can do git revert HEAD~2 where the number is how many commits back you want to go? Not sure if that is really a best practice though and would suggest copying everything somewhere first? @abkfenris @adamkemberling any thoughts?

adamkemberling commented 2 years ago

I think you should be able to return to a commit before those stages, then fetch upstream once you aren't ahead of the upstream. This guide steps through the first part using rstudio: https://ohi-science.org/news/github-going-back-in-time

abkfenris commented 2 years ago

You can use git revert or git reset to rewind your local repo, then git push --force to your branch.

dzaugis commented 2 years ago

Thanks, I will give it a go!