Skip to content

Latest commit

 

History

History
83 lines (53 loc) · 3.27 KB

CHANGELOG.md

File metadata and controls

83 lines (53 loc) · 3.27 KB

ASD 1: Git Workflow

1. Create a new repo on GitHub

2. Create file CHANGELOG.md with just a tittle and push it to master

3. Create a new branch develop from master

  • git switch -c develop

4. Create three new branches from develop, feature-one, feature-two, feature-three

  • git branch feature-one && git branch feature-two && git switch -c feature-three

5. On branch feature-three make 3 commits, each of these commits should add new content to the file f3.txt: f3.1, f3.2, f3.3

  • echo "f3.1" >> f3.txt && git add f3.txt && git commit -m "created f3 -> f3.1"
  • echo "f3.2" >> f3.txt && git add f3.txt && git commit -m "updated f3 -> f3.2"
  • echo "f3.3" >> f3.txt && git add f3.txt && git commit -m "updated f3 -> f3.3"

6. On branch feature-one make two commits adding to file f1.txt next content: f1.1, f1.2

  • git switch feature-one
  • echo "f1.1" >> f1.txt && git add f1.txt && git commit -m "created f1 -> f1.1"
  • echo "f1.2" >> f1.txt && git add f1.txt && git commit -m "updated f1 -> f1.2"

7. On branch feature-two make two commits adding to file f2.txt next content: f2.1, f2.2

  • git switch feature-two
  • echo "f2.1" >> f2.txt && git add f2.txt && git commit -m "created f2 -> f2.1"
  • echo "f2.2" >> f2.txt && git add f2.txt && git commit -m "updated f2 -> f2.2"

8. Using cherry-pick transfer second commit from feature-tree branch to feature-one branch

  • git switch feature-one
  • git log --oneline feature-three (to take sha1 of the 2nd commit) // ac753b5
  • git cherry-pick ac753b5 // confict appeared
  • git add f3.txt // resolve it by adding the file to the curent git branch
  • git cherry-pick --continue // can rename commit

9. Create a new hotfix branch from master called hotfix-one, create file hotfix.txt with content: hotfix

  • git switch -c hotfix-one master
  • echo "hotfix" >> hotfix.txt && git add hotfix.txt && git commit -m "hotfix"

10. Merge this branch into master and develop

  • git switch master && git merge hotfix-one
  • git switch develop && git merge hotfix-one
  • git branch -d hotfix-one // delete if this branch is not needed

11. Using rebase sync branch feature-one and develop

  • git switch feature-one && git rebase develop

12. Merge branch feature-one into develop using squash method

  • git switch develop && git merge --squash feature-one
  • git commit -m "merged feature-one branch using squash"

13. Using rebase sync branch feature-two with develop

  • git switch feature-two && git rebase develop

14. Merge branch feature-two with develop using squash

  • git switch develop && git merge --squash feature-two
  • git commit -m "merged feature-two branch using squash"

15. Make a release of the latest changes on develop

  • git switch master && git merge --squash develop
  • git commit -m "merged develop branch"
  • git push origin master
  • on GitHub page create new release