In this article I have cloned a project from Git and created a branch called feature/ticket2 in local. After required changes in feature/ticket2 branch pushed the changes to github.
Then you can see the feature/ticket2 branch pushed to github. and you can merge the feature/ticket2 branch with master branch.
Please follow the below steps and execute commands.
Step 1: Clone the project.
Open cmd & go to your project folder where you want to clone the project.
cd /Applications/MAMP/htdocs.
Now run the below command.
git clone https://github.com/john/laravel.git
Step 2: Run the below command to see how many branches are there. This step is optional.
git branch
step 3: create a new branch & make your code changes in that branch.
git checkout -b feature/ticket2
Switched to a new branch ‘feature/ticket2’
Step 4: Then you can change the code in your files. To see what files got changed/updated you can see using below command.
git status
It will show you which files has been modified as below.
modified: hello.txt
Step 6: then you have to add the modified files using below command.
git add hello.txt
Step 7: After adding the files, you need to commit the changes. It’s a good practice to ticket number in commit message in [].
git commit -m “[ticket2] committing the string changes”
The text in “” is the commit message for reference.
Step 8: Now you can check the status by
git status
Step 9: Now push the file to Github
git push origin feature/ticket2
Step 10: Now open github.
Open your repository which you have cloned. Then go to
Pull requests->New Pull Requests.
Choose base & compare branch.
Then create pull Request->Merge pull Request.
Now you can check that the master branch is updated with latest code.
I hope you will like this post. If you have any questions please post in comments sections.
Happy Blogging!!