I have a local checkout of a repository of a fork on my computer (from github). So on github I created a fork, and checked that out.
Now I want the local checkout to be the same as the original github repository (the one I created the fork from). I added that original repo to my local repo (with the name 'orig') and did the following:
git pull orig master
However, git status
shows me
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
Also git diff
or git diff origin/master
shows nothing.
Is there a way to make the local checkout equal to what is in the original master branch (without removing the local repo, the github fork, forking anew, checking out anew...)?
I do not care if there any uncommited changes or anything. I want the local checkout to be equal to the original repo...
There is nothing to fix. You simply have made 3 commits and haven't moved them to the remote branch yet. There are several options, depending on what you want to do: git push : move your changes to the remote (this might get rejected if there are already other changes on the remote)
If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.
You can reset your local branch to the one in orig, then push to your fork
git checkout master
git reset --hard origin/master
git push --force origin master
Your local repo and fork master branch will be the same as the original repo.
If need clean: git clean -f -d
Use the command below :
git reset --hard HEAD
I have had the same issue a couple of times now and the below is the solution I wrote down for myself. I don't know all the details but I know it got me out of trouble :).
Rolling back on Commits. (run "git status" between each step)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With