If you have not committed yet then find the last commit
git rev-list -n 1 HEAD -- <file_path>
Then checkout the version at the commit before.
git checkout <deleting_commit>^ -- <file_path>
If you have not committed yet then find the last commit
git rev-list -n 1 HEAD -- <file_path>
git checkout <deleting_commit>^ -- <file_path>
- git branch -r
- git branch -r -d stale-branch stale-branch …
Where “stale-branch” is the name of a remote-tracking branch that we no longer need.Once that is done, we can create our new “bare” repository, where we will all push to and pull from:
- cd /u/git
- sudo -u app mkdir -m 0770 exampleapp.git
- cd exampleapp.git
- sudo -u app git --bare init --shared=group
Then, we move back to our converted repository, and push it all to our bare repository:- git clone ssh://{repo-server}/u/git/exampleapp.git
Done!