Advertisement
kolay_ne

Permanently delete commit example

Jan 25th, 2021
1,604
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.58 KB | None | 0 0
  1. nikolay@KoLin:~/tmp$ git init
  2. Initialized empty Git repository in /home/nikolay/tmp/.git/
  3. nikolay@KoLin:~/tmp$ touch f g h
  4. nikolay@KoLin:~/tmp$ git add f
  5. nikolay@KoLin:~/tmp$ git commit -m f
  6. [master (root-commit) f9cbe42] f
  7.  1 file changed, 0 insertions(+), 0 deletions(-)
  8.  create mode 100644 f
  9. nikolay@KoLin:~/tmp$ git add g
  10. nikolay@KoLin:~/tmp$ git commit -m g
  11. [master c4f1c6e] g
  12.  1 file changed, 0 insertions(+), 0 deletions(-)
  13.  create mode 100644 g
  14. nikolay@KoLin:~/tmp$ git add h
  15. nikolay@KoLin:~/tmp$ git commit -m h
  16. [master bae0beb] h
  17.  1 file changed, 0 insertions(+), 0 deletions(-)
  18.  create mode 100644 h
  19. nikolay@KoLin:~/tmp$ git log
  20. commit bae0bebe5815e9ca32f43f47eb725ac020b6f0c3 (HEAD -> master)
  21. Author: Nikolay Nechaev <Nikolay_Nechaev@mail.ru>
  22. Date:   Mon Jan 25 16:45:25 2021 +0300
  23.  
  24.     h
  25.  
  26. commit c4f1c6e440988233098cc2dcb8ad8bf3cd1803a2
  27. Author: Nikolay Nechaev <Nikolay_Nechaev@mail.ru>
  28. Date:   Mon Jan 25 16:45:19 2021 +0300
  29.  
  30.     g
  31.  
  32. commit f9cbe428ff170dc400eaa42dd5eea8ef680b5fe5
  33. Author: Nikolay Nechaev <Nikolay_Nechaev@mail.ru>
  34. Date:   Mon Jan 25 16:45:14 2021 +0300
  35.  
  36.     f
  37. nikolay@KoLin:~/tmp$ VISUAL='sed -i -n /c4f1c6e/!p' git rebase -i c4f1c6e~
  38. Successfully rebased and updated refs/heads/master.
  39. nikolay@KoLin:~/tmp$ git log
  40. commit 2c868b1c50c1def4c60e122305dd402d29fb9fb9 (HEAD -> master)
  41. Author: Nikolay Nechaev <Nikolay_Nechaev@mail.ru>
  42. Date:   Mon Jan 25 16:45:25 2021 +0300
  43.  
  44.     h
  45.  
  46. commit f9cbe428ff170dc400eaa42dd5eea8ef680b5fe5
  47. Author: Nikolay Nechaev <Nikolay_Nechaev@mail.ru>
  48. Date:   Mon Jan 25 16:45:14 2021 +0300
  49.  
  50.     f
  51. nikolay@KoLin:~/tmp$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement