Our Git Workflow - Forks With Feature Branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Initialize new repository | |
- Create base develop branch | |
- Fork repository | |
- Clone your fork locally: | |
$ git clone [fork-repo-url] | |
- Add upstream remote: | |
$ git remote add upstream [main-repo-url] | |
- Create feature branch diverged from develop branch: | |
$ git checkout -b [branch-name] develop | |
- Get your work done and commit it to your repository: | |
$ git add [files-to-add] or git add -A | |
$ git commit -m "Commit message" | |
$ git push origin [branch-name] -u | |
- Create pull request to main repository | |
- Ask someone or wait for code review | |
- Fix your issues or conflicts if there are any | |
- Get your code merged to the main repository | |
- When it is time, merge develop branch to release branch by creating a pull request or merging it manually: | |
$ git fetch upstream | |
$ git checkout -b release-v0.1 upstream/develop | |
$ git push upstream release-v0.1 | |
- Test your branch, fix it if necessary by creating fix branches diverged from release: | |
$ git fetch upstream | |
$ git checkout -b [fix-branch-name] upstream/release-v0.1 | |
- Make pull requests with fixes, get them passed through code review and merged | |
- After everything is done, merge release branch to master (or create pull request) and tag it as a next successful milestone in your project: | |
$ git checkout master | |
$ git fetch upstream | |
$ git merge [release-branch] | |
$ git tag -a release-v0.1 | |
$ git push upstream master | |
- Repeat whole process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git checkout develop | |
$ git pull upstream develop | |
$ git merge [branch-name] | |
(resolve conflicts) | |
$ git add -A | |
$ git commit -am "Resolved conflicts" | |
$ git push upstream develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git checkout [branch-name] | |
$ git fetch upstream | |
$ git merge upstream/develop | |
(resolve conflicts) | |
$ git add -A | |
$ git commit -am "Resolved conflicts" | |
$ git push origin [branch-name] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
<<<<<<< HEAD | |
var foo = 'Hello Mom!'; | |
======= | |
var foo = 'Hey Dad!'; | |
>>>>>>> fix-foo | |
return foo; | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var foo = 'Hello Mom!'; | |
return foo; | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unmerged paths: | |
(use "git add <file>..." to mark resolution) | |
both modified: foo.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git remote add [repo-name] [repo-url] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git fetch [repo-name] [branch-name] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git branch -d [branch-name] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git branch -D [branch-name] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git push origin :[branch-name] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git checkout develop | |
$ git pull upstream develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git checkout develop | |
$ git fetch upstream | |
$ git merge upstream/develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git checkout -b [branch-name] [branch-head] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git branch -l | |
master | |
* develop | |
release-v0.1 | |
artf89349 | |
feature-photos-model | |
fix-videos-controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git fetch upstream master | |
$ git checkout -b hotfix-gallery-photos upstream/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git checkout master | |
$ git merge hotfix-gallery-photos | |
$ git push upstream master (push straight to upstream only if it's really urgent fix) | |
$ git checkout develop | |
$ git merge hotfix-gallery-photos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ssh user@host | |
$ git init [path-to-repository.git] --bare |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir [your-project] | |
$ cd [your-project] | |
$ git init | |
$ git remote add origin [repo-url] | |
$ touch README.md (to create README file) | |
$ git add README.md | |
$ git commit -m "Init commit" | |
$ git push origin master -u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git checkout -b develop | |
$ git push origin develop -u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git clone [forked-repo-url] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git remote add upstream [main-repo-url] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git checkout [branch-name] | |
(fix all the issues) | |
$ git commit -m "Commit message" | |
$ git push origin [branch-name] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git push [repo-name] [branch-name] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git fetch upstream develop | |
$ git checkout -b release-v0.1 upstream/develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git fetch upstream release-v0.1 | |
$ git checkout -b fix-broken-tiles upstream/release-v0.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment