1
0
mirror of https://github.com/namibia/tips.git synced 2024-11-16 10:05:17 +00:00

Using revert and reset

This commit is contained in:
Samar Panda 2015-07-31 16:13:57 +05:30
parent de65ecb886
commit 4cdc87f48e
2 changed files with 20 additions and 0 deletions

View File

@ -19,6 +19,8 @@
* [Delete local branch](https://github.com/git-tips/tips#delete-local-branch) * [Delete local branch](https://github.com/git-tips/tips#delete-local-branch)
* [Delete remote branch](https://github.com/git-tips/tips#delete-remote-branch) * [Delete remote branch](https://github.com/git-tips/tips#delete-remote-branch)
* [Undo local changes with the last content in head](https://github.com/git-tips/tips#undo-local-changes-with-the-last-content-in-head) * [Undo local changes with the last content in head](https://github.com/git-tips/tips#undo-local-changes-with-the-last-content-in-head)
* [Revert: Undo a commit by creating a new commit](https://github.com/git-tips/tips#revert-undo-a-commit-by-creating-a-new-commit)
* [Resert: Discard commits, advised for private branch](https://github.com/git-tips/tips#resert-discard-commits-advised-for-private-branch)
* [Reword the previous commit message](https://github.com/git-tips/tips#reword-the-previous-commit-message) * [Reword the previous commit message](https://github.com/git-tips/tips#reword-the-previous-commit-message)
* [Changing a remote's URL](https://github.com/git-tips/tips#changing-a-remotes-url) * [Changing a remote's URL](https://github.com/git-tips/tips#changing-a-remotes-url)
* [Get list of all remote references](https://github.com/git-tips/tips#get-list-of-all-remote-references) * [Get list of all remote references](https://github.com/git-tips/tips#get-list-of-all-remote-references)
@ -134,6 +136,16 @@ git push origin :<remote_branchname>
git checkout -- <file_name> git checkout -- <file_name>
``` ```
## Revert: Undo a commit by creating a new commit
```sh
git revert <commit-ish>
```
## Resert: Discard commits, advised for private branch
```sh
git reset <commit-ish>
```
## Reword the previous commit message ## Reword the previous commit message
```sh ```sh
git commit -v --amend git commit -v --amend

View File

@ -64,6 +64,14 @@
"title": "Undo local changes with the last content in head", "title": "Undo local changes with the last content in head",
"tip": "git checkout -- <file_name>" "tip": "git checkout -- <file_name>"
}, },
{
"title":"Revert: Undo a commit by creating a new commit",
"tip":"git revert <commit-ish>"
},
{
"title":"Resert: Discard commits, advised for private branch",
"tip":"git reset <commit-ish>"
},
{ {
"title": "Reword the previous commit message", "title": "Reword the previous commit message",
"tip": "git commit -v --amend" "tip": "git commit -v --amend"