Sunday, October 20, 2019

Lesson 6.0: Compare git reset vs git revert

  1. Git reset: là reverts những thay đổi bằng cách duy chuyển về lần commit cũ trước đó. In this sense, bạn có thể nghĩ là "rewriting history". git reset sẽ move branch backwards as nếu commit sau đó sẽ chưa không bao giờ đc thực hiện
 Let's see  what that looks like:
       
   You try to type: `git reset HEAD~1`


 2.Git revert: while resetting works great for local branches on your own machine. Khi đó nó sẽ copy node và đi tiếp. Bởi vì khi dùng reset, to commit thì nó sẽ ra một branch khác nên ta dùng git revert. Let's see it in action:
You try to type: `git revert HEAD `
 Examples:



Goal:
Answer:
$ git reset HEAD~1
$ git checkout pushed
$ git rever HEAD

No comments:

Post a Comment