Skip to content

Latest commit

 

History

History
143 lines (114 loc) · 5.57 KB

CONTRIBUTING-gitflow.md

File metadata and controls

143 lines (114 loc) · 5.57 KB

Setting Project on Local System :-

  • Fork the Repository of Project


  • ( You will see this on Top Right of Github Repository !)

  • Clone your fork to your local machine



  • ( Click on the Green Code button and Copy the link `https://github.com/........` )

  • Open Git bash where you want to clone the project ( Avoid On Desktop )

  • Run Command


  • git clone <insert-link>
    (NOTE: In Place of insert-link paste the link you copied)

    Project Cloned in System🌟



  • Add 'upstream' repo to list of remotes


  • Keeping Your Fork Updated In order to get the latest updates from the development trunk do a one-time setup to establish the main GitHub repo as a remote by entering:

    git remote add upstream https://github.com/meshery/meshery.git

    ("meshery" is used as the example repo. Be sure to reference the actual repo you're contributing to e.g. "meshery-linkerd").

  • Verify the new remote named 'upstream'


  • git remote -v

  • Fetch from upstream remote


  • You'll need to fetch the upstream repo's branches and newest commits to bring them into your repository whenever you wish to update your fork with the latest upstream changes:

    git fetch upstream

  • Checkout your master branch and merge upstream


  • Now, checkout your master branch and merge it with the master branch of the upstream repo:

    git checkout master
    git merge upstream/master

    If the local master branch has no unique commits, git will simply execute a fast-forward. However, if you've been making modifications to master (which, in the vast majority of circumstances, you shouldn't be - see the next section), you may run into issues. Always keep in mind the changes made upstream when doing so.
    Your local master branch is now up to date with everything that has been changed upstream.

  • Create a Branch (to avoid conflicts)


  • It's essential to create a new branch whenever you start working on a new feature or bugfix. Not only is it a standard git workflow, but it also organises and separates your modifications from the main branch, allowing you to simply submit and manage several pull requests for each task you finish.
    Follow the steps below to establish a new branch and begin working on it.

  • Check out the master branch; from which your new branch will be derived.


  • git checkout master

  • Create a new branch

  • (Give your branch a simple, informative name.)
    For continuous integration changes use

    ci/your_username/issue#
    OR
    feature/your_username/name_of_feature

    For bugs use

    bug/your_username/issue#
    OR
    bug/your_username/name_of_bug

    git branch feature/jdoe/567

  • Switch to your new branch


  • git checkout feature/jdoe/567
    (NOTE: Use the name of the branch you created instead of 'feature/jdoe/567'.)

    Now you may start hacking and make any changes you desire.🚀

  • Stage the Changes


  • git add [files-changed]
    (NOTE: This will stage all the changes you have made.)

  • Commit Changes


  • git commit -m "MESSAGE"
    (NOTE: Instead of 'MESSAGE,' include a commit message so the maintainer can see what you've done.Also make sure to get the DCO signed.)

  • Creating Pull Request on Github


  • Before submitting your pull request, you should clean up your branch and make it as easy as possible for the maintainer of the original repository to test, accept, and integrate your work.

    If any commits to the upstream master branch have been made during the period you've been working on your changes, you'll need to rebase your development branch so that merging it will be a simple fast-forward with no conflict resolution work.

  • Fetch upstream master and merge with your repo's master branch


  • git fetch upstream
    git checkout master
    git merge upstream/master

  • If there were any new commits, rebase your development branch


  • git checkout feature/jdoe/567
    git rebase master

    Now, it may be desirable to squash some of your smaller commits down into a small number of larger more cohesive commits. You can do this with an interactive rebase:

  • Rebase all commits on your development branch


  • git checkout
    git rebase -i master

    This will open up a text editor where you can specify which commits to squash.

  • References

  • Git Reference Docs
    git-rebase / Interactive Mode

  • Submit the Changes

  • Go to the page for your fork on GitHub, select your development branch, then click the pull request button once you've committed and submitted all of your changes. Simply upload the changes to GitHub if you need to make any changes to your pull request.

    Your pull request will track and update changes in your development branch automatically.🌸