Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. # Git new branch-rebase-merge process.
  2. # On this snippet we changed the name of the folder
  3. # license to license-repo.
  4.  
  5. # Get last changes and create a new branch.
  6. git pull origin master
  7. git checkout -b license-repo
  8.  
  9. # Here we make changes to the repository and add our commits.
  10. # Rename folder license to license-repo.
  11. git rm license/mit.inc
  12. git add license-repo/mit.inc
  13. git commit -m "Renamed folder license to license-repo for legibility"
  14.  
  15. # Show commits.
  16. git log --graph --decorate --pretty=oneline --abbrev-commit
  17. # Shows:
  18. # * e3684b3 (HEAD -> license-repo) Updated file layout
  19. # * 30ed677 Rename license to license-repo for legibility
  20. # * 7854b7e (origin/master, origin/HEAD, master) Added all parts
  21.  
  22. # Open the editor to select the commits to squash (squash all in one).
  23. git rebase -i HEAD~2
  24. # When the editor is open, change 'pick' to 's' (squash) on the second commit message.
  25.  
  26. # The editor will show something like:
  27.  
  28. # pick 30ed677 Rename license to license-repo for legibility
  29. # pick e3684b3 Updated file layout
  30.  
  31. # Rebase 7854b7e..30ed677 onto 7854b7e (1 command)
  32. #
  33. # Commands:
  34. # p, pick = use commit
  35. # r, reword = use commit, but edit the commit message
  36. # e, edit = use commit, but stop for amending
  37. # s, squash = use commit, but meld into previous commit
  38.  
  39. # Change:
  40. # pick 30ed677 Rename license to license-repo for legibility
  41. # pick e3684b3 Updated file layout
  42.  
  43. # To:
  44. # pick 30ed677 Rename license to license-repo for legibility
  45. # s e3684b3 Updated file layout
  46.  
  47. # Save the file and close the editor.
  48.  
  49. # Show new commits history.
  50. git log --graph --decorate --pretty=oneline --abbrev-commit
  51. # Shows:
  52. # * e5126bd (HEAD -> license-repo) Rename license to license-repo for legibility
  53. # * 7854b7e (origin/master, origin/HEAD, master) Added all parts
  54.  
  55. # Upload changes.
  56. git push origin license-repo
  57.  
  58. # Rebase process.
  59. git checkout master
  60. git pull origin master
  61. git checkout license-repo
  62. git rebase master
  63. # If new repository this could show the warning: Current branch license-repo is up to date.
  64.  
  65. # Upload changes.
  66. git push origin license-repo --force
  67. # If new repository this could show: Everything up-to-date.
  68.  
  69. # Merge process.
  70. git checkout master
  71. git merge license-repo
  72. # Shows something like:
  73. # Updating 7854b7e..e5126bd
  74. # Fast-forward
  75. # README.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
  76. # {license => license-repo}/mit.inc | 0
  77. # 2 files changed, 73 insertions(+), 24 deletions(-)
  78. # rename {license => license-repo}/mit.inc (100%)
  79.  
  80. # Upload changes.
  81. git push origin master
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement