Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git reset --hard equivalent on bare repository

Tags:

git

git-bare

After last commit my team decided remote has grown too heavy and would be better to make a new one to split tasks between asset testing (heavy repo) and functionality testing (light repo). So I made a push --mirror and created a new repo, but it is still affected by a last commit and appears to be too heavy. Is it possible to revert last commit on a new repository before cloning to local machine? (since all heavy assets added with the last commit are unuseful for new repo)

like image 705
user3081123 Avatar asked Sep 18 '25 02:09

user3081123


1 Answers

The command

git push -f . commit:branch

can achieve the same effect on a bare repository by resetting the branch named "branch" to point to commit commit.

Note that it works in normal repositories, too, except for cases where the branch you're about to reposition is currently checked out and the commit HEAD points at is not commit.

There's also the git update-ref command but I'd say it's too low level to use under "normal" circumstances.

like image 119
kostix Avatar answered Sep 20 '25 19:09

kostix