Skip to content

Instantly share code, notes, and snippets.

@ShreyaDhir
Last active July 1, 2021 15:47
Show Gist options
  • Select an option

  • Save ShreyaDhir/e4a9094ef2dc0279a93c0009460b0c90 to your computer and use it in GitHub Desktop.

Select an option

Save ShreyaDhir/e4a9094ef2dc0279a93c0009460b0c90 to your computer and use it in GitHub Desktop.
A guid to fork and commit your code w/o a sweat

Step: 1 - Fork the project repository

Step: 2 - Clone your forked project repository git clone https://github.com/<your_github_username>/Whatsapp-Clone.git

Step: 3 - Navigate to your forked/local repository cd Whatsapp-Clone

Step: 4 - Check that your fork is the "origin" remote git remote -v [You should now see 2 'origin' url]

Step: 5 - If you don't see an "origin" remote, you can add it using: git remote add origin https://github.com/<your_github_username>/Whatsapp-Clone.git

Step: 6 - Add the project repository as the "upstream" remote git remote add upstream https://github.com/ShreyaDhir/Whatsapp-Clone.git

Step: 7 - Check whether you have both origin and upstream added git remote -v [You should now see 4 url]

Step: 8 - Pull the latest changes from upstream into your local repository git pull upstream main

Step: 9 - Create a new branch (apart from main) git checkout -b BRANCH_NAME [Example - git checkout -b jungkook]

Step: 10 - Done with your coding, its time to commit it.

Step: 11 - Commit your changes
            Step: 11.1 - Add and stage your changes git add .
            Step: 11.2 - Commit your changes with a suitable and descriptive commit message git commit -m "DESCRIPTION OF CHANGES" [Example - git commit -m "Update: Sidebar UI and Node.js Server config"

Step: 12 - Push your changes to your fork - git push origin jungkook

Step: 13 - Begin Pull Request Go back to your forked repo on Github where now you'll see a highlighted box with a Green button "Compare & pull request". Click on the Green Button. Then click on "New Pull Request"

Step: 14 - Create the pull request Click on the bottom right button "Create pull request"

Step: 15 - Review/Request Review by other members for the pull request: [By yourself and and also by others]

🚨 Last and most important!

Step: 16 - Synchronize your fork with the project repository - when someone's PR is merged to main
            Step: 16.1 - Go to your forked branch Click on "Fetch Upstream" and then on "Fetch and Merge". This will allow commits merged by, for example, Hoseok on the main to also be merged on Jungkook's forked/local repo.
            Step: 16.2 - Pull the Synchronize code git pull upstream main

You're done! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment