git-branch & git-merge
Quick Note:
Always commit with a useful message. Otherwise, your history will be useless…
# Show your most recent commits
git show-branch --all
Assuming prior knowledge of
git pull; git add; git commit; git push
#TODO:
-
Fork a repository: octocat/Spoon-Knife
-
Create a new branch
-
Make changes to existing code or develop code.
-
Merge your new branch to the master branch to create a Pull Request
After forking octocat/Spoon-Knife — get a local copy:
git clone https://github.com/USERNAME/Spoon-Knife.git
Creating a new branch
git branch [new branch]
git checkout [new branch] # git checkout -b [new branch]
git add [stuff/work]
git commit -m "my new work"
git push --set-upstream origin [new branch]
Check what’s been done:
git show-branch
Merging new branch to another branch
git checkout [branch]
git merge [new branch]
git push origin [branch]
Now, in your browser create a pull request.
Fetching the Pull Request (For Maintainer):
Step 1: From your project repository, bring in the changes and test.
git fetch origin
git checkout -b [new branch] origin/[new branch]
git merge master
Step 2: Merge the changes and update on GitHub.
git checkout master
git merge --no-ff [new branch]
git push origin master
Other Notes:
Information commands to learn about git
man giteveryday
man gittutorial