Let’s create a new local branch and push it to GitHub.
Begin by creating a branch, as we did earlier.
git checkout -b update-readme
Switched to a new branch 'update-readme'
Next, make some changes to the README.md file by adding a new line.
Then, check the status of the current branch.
git status
We see that README.md
has been modified but not yet added to the staging area.
git add README.md
Check the status of the branch.
git status
We are satisfied with our changes, so we will commit them to the branch.
git commit -m “Updated readme for GitHub Branches”
Now push the branch from your local Git repository to GitHub so everyone can see the changes.
[user@localhost] $ |
git push origin update-readme |
Go to GitHub and verify that the repository now has the new branch.
On GitHub, you can now see the changes and merge them into the master branch if you approve them.
By clicking “Compare & pull request,” you can review the changes and any new files added.