Home Tip of the day - Submitting code to open source github project
Post
Cancel

Tip of the day - Submitting code to open source github project

Tip of the day: git commands to submit code to open source project. CheatSheet

When submitting code to open source project, you need to have the latest code from the main branch. If you don’t, you will get merge conflicts. To avoid this, you need to fetch the latest code from the main branch and rebase your branch on top of it. This is the list of commands you need to run.

Commands

  1. When your are in your local fork repo, run in console:
    1
    
           git checkout main
    

    Note: “main” is a name of branch.

  2. If you have remote named “upstream” which points to the original repo, run in console:
    1
    
           git fetch upstream
    
  3. Update your local “main” branch with the latest code from the original repo:
    1
    
           git pull --rebase upstream main
    
  4. Create a new branch name “updates-myupdate” for your changes:
    1
    
           git checkout -b updates-myupdate
    
  5. Make your changes and commit them:
    1
    
           git commit -m "My update"
    
  6. Push your changes to your forked repo:
    1
    
           git push origin updates-myupdate
    
  7. Create a pull request from your forked repo to the original repo.
    1
    
           git pull --rebase upstream main
    
This post is licensed under CC BY 4.0 by the author.

Tip of the day handlebar helper ifEquals, join, json, math, switch, case, and default

Tip of the day - Powershell for April first. Tricks and pranks part 1