Set older revision to be the HEAD, revert to previous state with “git push”, undo remote historyBy neokrates, written on July 15, 2010 |
git snippet |
- neokrates
- Email: uwarov@yahoo.com
- Website: http://www.thinkplexx.com
- Join date: 05-31-09
- Posts: 20
Which SQL implementations are mostly used in your projects?
- MySQL (44%, 4 Votes)
- We don't use SQL (44%, 4 Votes)
- MS SQL Server (22%, 2 Votes)
- Oracle (11%, 1 Votes)
- Standard (0%, 0 Votes)
- PostgreSQL (0%, 0 Votes)
- DB2 (0%, 0 Votes)
- mSQL (0%, 0 Votes)
- Informix (0%, 0 Votes)
- Something else (0%, 0 Votes)
Total Voters: 9
Loading ...
You have some status in the repository which you want “HEAD” to point to. With Git remote HEAD can be set by forcing the push command.
Such method is useful for example if you want rollback or undo your commits until some particular revision. After you done, master revision is altered.
History in the remote repository is erased as well as changes until the new HEAD revision. Anyone who makes a new clone will get the ‘new’ HEAD you just set.
If you or someone else pushes the ‘OLD’ repository state, the history will be restored. Pushing changes from the clone made after git push -f origin works OK and creates new ‘commit history’ from the point you set.
| 1 |
List avalable revisions
# git rev-list HEAD
70c5717dce2e023943cc4168dc95632a5baee6af
bc84dc5eb220a471c9a5a932fe7ef2e4501320be
fa1504a9e5b0d1e0ee6064a9b80c838dc81a8ef9
442448e186a03db5f5470ca438e69b2ee2a67f71
4b9bfe2dd388d34ba5ba4400990e69744af44fd2
6c138222515306009c35303e9a4653573875b992
daae8a1798c8d66bbe1738d177ed9075abaa94d6
5b96cb0d40b1f55a935f5c74970b72421fef6d00
e08918323e03800468e1d8de8d813ac2c1383408| 2 |
Set new HEAD
# git push -f origin 5b96cb0d40b1f55a935f5c74970b72421fef6d00:master Total 0 (delta 0), reused 0 (delta 0) => Syncing Gitorious... [OK] To git@your.git.repo:your-project/your-repo.git + daae8a1...5b96cb0 5b96cb0 -> master (forced update)
| 3 |
And for any other branch
git checkout your-branch git rev-list your-branch // select your rev, i.e. SHA1 = 4b9bfe2dd388 git push -f origin 4b9bfe2dd388:your-branch
|
TAGS
|
|
SOCIAL
|



















Thanks a lot!
Like or Dislike:
0
0