Answer the question
In order to leave comments, you need to log in
How to bring a local git repository in line with a remote one?
On my computer, I screwed up a little with branching. Created several unnecessary branches. Moved master. And generally lost in the branches. Tell me how to return the local working directory and all branches to the form that is now in the remote repository?
Answer the question
In order to leave comments, you need to log in
Made a clone to a neighboring directory
Deleted a folder .git
from the working directory
Moved .git
from a newly created clone
Made a reset in the working directory
cd public_html/
git reset --hard
cd ../
rm -rf public_html2
If there are no necessary edits of local branches -
git checkout branch_name
git reset --hard origin/branch_name
If there is - create a folder nearby, raise git there
Add it as a second origin and push the necessary branches into it.
Go back to option 1
Then sever edits and remove the second turnip.
It's enough just to create a temporary branch at the end of the one you are going to fix
git checkout branch_name
git checkout -b temp
branch_name
whatever you want with it. temp
won't let the commits go to waste. Well, then git cherry-pick
everything that is needed in the corrected branch or in any other.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question