Create PR

Create a clean Pull Request in Git (Step by Step) )

Create a clean pull request in Git in a new folder/directory. This tutorial is going to help you in setting up a new project in your laptop and also creating a PR of your work.

In order to start this tutorial we are:

– Assuming that you have git set up in environment variables and installed already.

– Assuming that you’ve not cloned any repository.

Go to the directory that you want to push to the cloud (GitHub or Bitbucket). Open the terminal and follow the below steps:

Steps to create clean pull request:

  1. Initialize git in the current directory git init
  2. Check whether you already have branches or not git remote -v
    if you see nothing, means you haven’t added master and origin, so continue else skip steps 3 and 4
  3. To add a remote connection with git git remote add origin "https or git address of your repo" without quotes (shown in picture)”

    create pull request

  4. To add a git remote branch named “master” git remote add add master "same address again"
  5. Now retrieve any changes on the remote master branch git fetch origin master
  6. Bring all changes in your current directory from the remote master branch git pull origin master (execute these 6,7 steps so that you have the latest code on your local, this is best practice. Now you are currently on the master branch
  7. Make some changes, for example, create a file by typing this command touch test_file
  8. To push these changes to the new branch, create a new branch (important to note that you are already on the master branch, all new branches should be made when the user already checked as master) git checkout -b new_branch
  9. Now run git add --all
  10. Add a commit message git commit -m "committing a test_file"
  11. Now push the changes to the newly created branch git push origin new_branch 
  12. Now do git checkout master If you want to add more branches if not skip this step and continue working in new_branch
  13. Now go to your bitbucket or github.com login, click “create pull request” you’ll see branch “new_branch” is created on the other side choose “master” give notes, and hit the “create pull request” button
  14. Done.

That’s it for the day, folks. Check out some other interesting blogs and comment. Comments are the only that can help me improve the blog and the kind of content you are looking for from me.

Tags: No tags

Add a Comment

Your email address will not be published. Required fields are marked *