Git - How to work on Forked Branch - onlinetutorialspoint

PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
JAVAEXCEPTIONSCOLLECTIONSSWINGJDBC
EXCEPTIONS
COLLECTIONS
SWING
JDBC
JAVA 8
SPRING
SPRING BOOT
HIBERNATE
PYTHON
PHP
JQUERY
PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
This example will help illustrate the standards and best practices of working on GIT Forked Branch.
Let’s consider the scenario like, John is developing a new feature in the Car application that allows cars to honk.  Sally is the ops engineer who will be responsible for releasing the code changes on May 10th, 2021.  The repository is named after the application (Car).
First, John needs to go to the team’s organization in Github since he has never worked on the Car project before.  Once he finds the project, he will click the Fork button to copy that repository to his own user’s account.
To work on code, he will need to checkout or clone the repository to his computer.  We’ll assume he’s using Linux.  The URL to use to clone the repository can be found on his forked copy of the project in Github.
$ git clone git@github.com:john1234/Car.git

This will clone the repository to his local disk.  The local repository will be set to track his repository on Github, and the link to his forked copy on Github is called origin.  He will also need to track changes from the upstream repository he initially forked from, so he’ll need to add that link, or remote, as well.
$ git remote add upstream git@github.com:chandra-goka/Car.git
This will create another remote link to a repository we’ll name upstream.
John follows the best practices of this guide and creates a feature branch for his changes.
$ git checkout development
$ git checkout -b honk-feature
John then develops his changes to the application to implement the honking functionality to the Car application.  He makes several commits along the way, for example:
$ git add .
$ git commit -m "Added button stub to initiate a honk."
Before John merges his changes into upstream, it is important he download any changes made to the upstream branch before creating the pull request.  He will also rebase to avoid unnecessary merge commits in the pull request.
$ git fetch upstream
$ git rebase upstream/development
$ git push -u --force origin honk-feature
To get his changes accepted to the upstream repository, John goes to the Car project in his account in Github, and accesses the pull request feature.  He makes sure to set the source for the pull request to his forked repository and his feature branch, and the destination to the upstream repository and the development branch.  He types a descriptive title along with a list of changes in the description of the pull request.  Once the pull request is created, he copies the URL of the pull request and emails the team list notifying the rest of the team that a pull request exists, and what the changes in the pull request are.
Another team member, Chris, sees the pull request and reviews it.  He finds the changes acceptable and merges the pull request.
John creates a release pull request from the upstream’s development branch into the master branch.  He names the title as “2021 May 10 – Scheduled Release”, and links the release page on the wiki in the pull request’s description.  On 5/10/2021, Sally pulls the pull request and deploys the application.
Git Fork
Install GIT
How to push the code to remote branch
Happy Learning 🙂

Step by Step – How to push the project into GIT Repository
How to Install Git windows 10 Operating System
How to push docker image to docker hub ?
How to work with Union in C
How to Copy Local Files to AWS EC2 instance Manually ?
Python Django Helloworld Example
Python – Selenium Download a File in Headless Mode
Error response from daemon: Cannot kill container: XXX: Container XXX is not running
Step By Step Spring Boot Docker Deployment Example
C How to Pass Arrays to Functions
Step by Step Tutorials AngularJs Example
AngularJs Directive Example Tutorials
How to install Docker Toolbox on Windows 10
Rendering Static HTML page using Django
Install Docker Desktop on Windows 10

Step by Step – How to push the project into GIT Repository
How to Install Git windows 10 Operating System
How to push docker image to docker hub ?
How to work with Union in C
How to Copy Local Files to AWS EC2 instance Manually ?
Python Django Helloworld Example
Python – Selenium Download a File in Headless Mode
Error response from daemon: Cannot kill container: XXX: Container XXX is not running
Step By Step Spring Boot Docker Deployment Example
C How to Pass Arrays to Functions
Step by Step Tutorials AngularJs Example
AngularJs Directive Example Tutorials
How to install Docker Toolbox on Windows 10
Rendering Static HTML page using Django
Install Docker Desktop on Windows 10