Skip to content

Instantly share code, notes, and snippets.

@lflfm
Last active September 2, 2020 07:54
Show Gist options
  • Save lflfm/6676fdca2409b54acce8171bd77ae51e to your computer and use it in GitHub Desktop.
Save lflfm/6676fdca2409b54acce8171bd77ae51e to your computer and use it in GitHub Desktop.
Pretty safe and solid git flow

new user story, based on dev branch

source

  1. (any_branch) git checkout dev
  2. (dev) git pull
  3. (dev) git checkout -b USxxx_descr #create new branch for the US ...
  4. do your changes
  5. (USxxx_descr) git add (file) (file) (etc...) or git add --all
  6. (USxxx_descr) git status check that everything is correct (only files you really want to change are added)
  7. (USxxx_descr) git diff --cached review the differences and ensure that nothing was changed by accident
  8. correct anything identified, remove debug/test/temporary code etc.. then add/status/diff until all is good
  9. (USxxx_descr) `git commit -m "comment" .... repeat, etc...
  10. all good to send off? ok:
  11. (USxxx_descr) git checkout dev
  12. (dev) git pull #if you get any conflict message, STOP and ask for help
  13. (dev) git checkout USxxx_descr #back to your branch with changes
  14. (USxxx_descr) git rebase dev #do the rebase to bring changes from dev to your branch and replicate your changes as if they were new
  15. Check rebase results: if it was automatic, ok; otherwise you need to treat it. Look at git status and the branch name to see if there's anything out of place
  16. .... treat conflicts of the rebase (opening each file that shows up in git status and sorting out conflicts, then I don't remmeber if it's commit ir rebase continue... let's see when it happend :D)
  17. (USxxx_descr) git push #try to push, git will tell you that it needs to be forced (if it says something else, STOP and ask for help)
  18. run the forced push that git sugests (if it's not suggesting a forced commit, STOP and ask for help)
  19. (USxxx_descr) git checkout dev or git checkout -b USxxx_otherUS #go back to dev or create a new branch from this one if you need these changes for the next US
  20. Use the online tools (eg. GitHub/Git Lab) to create and process a pull request from USxxx_descr to dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment