How do I undo a checkout in git?

Try this first: git checkout master (If you’re on a different branch than master (or main), use the branch name there instead.) If that doesn’t work, try… For a single file: git checkout HEAD /path/to/file For the entire repository working copy: git reset –hard HEAD And if that doesn’t work, then you can look in … Read more

git: switch branch without detaching head

# first time: make origin/branchname locally available as localname git checkout -b localname origin/branchname # othertimes git checkout localname git push origin For convenience, you may use the same string for localname & branchname When you checked out origin/branchname you weren’t really checking out a branch. origin/branchname is a “remote” name, and you can get … Read more

How do I update my bare repo?

If you want to duplicate all the objects from the main repo, do this inside the main repo: git push –all <url-of-bare-repo> Alternatively, do a fetch inside the bare repo: git fetch <url-of-main-repo> You cannot do a pull, because a pull wants to merge with HEAD, which a bare repo does not have. You can … Read more