Course Content
GitHub Fundamentals
GitHub Fundamentals
Pushing Local Branches
Creating a separate branch for a new feature is an extremely common practice when using Git. Suppose we want to implement a payment system in our project, so let's create a feature/payment
branch and switch to it immediately:
Once on this branch, we will make some changes in the test.txt
file as if we were adding some lines of code to implement a payment system. Let's simply append this line: "A few lines of code" to the file:
Next, we can make a direct commit:
We now have a commit on our feature/payment
branch. Before merging this branch into the main
branch, let's first push it to the remote repository.
The first time we push a new branch to the remote repository, we need to include some additional parameters in the git push
command. Specifically, we need to use the -u
flag to set up the branch to track the corresponding remote branch (known as upstream
). We also need to specify that we are pushing to the origin
repository and indicate that we are pushing the feature/payment
branch.
Thanks for your feedback!