Skip to content

GitLab-Tutorialz/test-repository

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Git Commands

# git log --oneline
97c32d3 (HEAD -> main, origin/main, origin/HEAD) teste
044bd22 new test
afb058c Initial commit
# git log --pretty=short
commit 97c32d37441916d3918c7e579767b32879eaec53 (HEAD -> main, origin/main, origin/HEAD)
Author: Amaury Borges Souza <[email protected]>

    teste

commit 044bd22abfe1fa3a468507133e98ee322c746cbc
Author: amaurybsouza <[email protected]>

    new test

commit afb058c4b0dacda07266578df6e670a999d86115
Author: Amaury Borges Souza <[email protected]>

    Initial commit

How to revert a commit done on the master

  • First of all, you need check a git log command to check the log of commits
# git log

Now you can proceed:

# git revert 011b2e306e2edf968820a44b38a5d52d9772c0a

OBS: for good practices, NEVER change the history on the master, always use git revert command, it's don't change the history.

Other Git commands

# git reset - used to separeted branches
# git revert - used to on the master
# git push origin master --force - used to force the push
# git commit --amend - used to change the last commit message (do this before to push to remote repository)
# git cherry-pick 011b2e306e2edf968820a44b38a5d52d9772c0a - used to get the commit message from another branch