Skip to content

Instantly share code, notes, and snippets.

@ccabanero
Last active February 25, 2022 16:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccabanero/943aa632882782b69ab03c54b4b687d3 to your computer and use it in GitHub Desktop.
Save ccabanero/943aa632882782b69ab03c54b4b687d3 to your computer and use it in GitHub Desktop.
git-ref
1. Create an empty develop branch (off of master) and pushes it to the server
git branch development
git push -u origin development
2. Clone the central repo and creates a tracking branch for develop
git clone url/to/repo
git checkout development
5. Implement a feature
a. create a feature branch
git checkout -b some-feature
b. implement feature
git status
git add -A
git commit -m 'bla bla'
c. test stuff
d. merge feature into develop
# close Xcode ;) ... or at the very least select a file that is NOT a storyboard
# make sure local develop has the latest from remote develop
git checkout development
git pull
# rebase develop into local feature branch
git checkout some-feature
git rebase -i development
[SHIFT] + [:] + q + [ENTER]
# test stuff
# merge into development
git checkout development
git merge some-feature
# after successful merge to local develop - push to develop on server
git push origin development
# clean up local feature branch
git branch -d some-feature
# (if applicatable) clean up remote feature branch
git push origin --delete some-feature
6. Prepare the release branch
git checkout master
git pull
git checkout development
git rebase -i master
[SHIFT] + [:] + q
git checkout master
git merge development
git push origin master
7. Add a tag to the release repo (i.e. master)
git tag -a vX.X.X -m "vX.X.X"
e.g. git tag -a v1.2.0 -m "v1.2.0"
git push --tags
8. Revert a local and remote branch to a specific commit
git reset --hard <old-commit-id>
git push -f origin <branch-name>
9. Master branch should be replaced with Development Branch
git checkout development
git merge -s ours master
git checkout master
git merge development
git push origin master
10. Make master the same as development
git checkout development
git merge -s ours master
git checkout master
git merge development
git push origin master
11. You made a branch (feat-clintstuff) off of development. Team member merges changes into development branch (e.g. their PR is approved and merged). You want those recent changes in the development branch in your local feature branch (i.e. feat-clintstuff).
git checkout develop
git pull -p
git checkout feature_branch
git merge develop
git push origin feature_branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment