🕎 GIT Revert vs GIT Reset git revert and git reset are two commands in Git used for different purposes, and they have distinct effects on your repository's history. 🏀 git revert: This command is used to undo a commit by creating a new commit that undoes the changes made by the specified commit. It's a safe way to undo changes because it doesn't alter the existing commit history. It's useful when you want to keep a record of the fact that you've undone a change. Example: 🏑 git revert <commit-hash> 🏀 git reset: This command is used to reset the current branch to a specific state. It can be used to move the HEAD and the branch pointer to a different commit, effectively "rewinding" the history. There are different modes of git reset, notably --soft, --mixed, and --hard, which determine what happens to the staged and working directory changes. 🔮 --soft: Moves the HEAD to the specified commit, but leaves the changes staged. 🔮 --mixed: Default behavior if no mode is specified. Moves the HEAD and unstages the changes, but leaves them in the working directory. 🔮 --hard: Moves the HEAD to the specified commit and discards all changes (staged and working directory) after that commit. Example: 🏑 git reset --hard <commit-hash> In summary, git revert is used to undo specific commits while preserving history, whereas git reset is used to move the current branch pointer to a different commit, potentially altering history. The choice between them depends on whether you want to preserve the history or not. #git #devops #commands #learning
Hello ma'am firstly thanks for sharing such knowledge on every concept it's really helpful......and also will you cover up Azure concepts as well !!!! Request from my side 😊
Analyst @ PowerLaw Pvt Ltd | Cloud DevOps Engineer | Helping Organizations Build Scalable Applications | AWS | LINUX | CI/CD | Jenkins | Ansible | Git | Github | Docker | Kubernetes |Terraform | Networking |
9moThank you for sharing ....bhavya bojanapalli mam