Tips for git management - JETSCAPE/X-SCAPE GitHub Wiki
The recommended way to develop code and request that it be added to the next X-SCAPE release is to develop your code in a public fork of X-SCAPE, and then make a pull request:
- First, fork X-SCAPE via the github interface.
- Next, go to the directory on your machine where you would like to develop your local fork of X-SCAPE, and clone X-SCAPE:
git clone [email protected]:<my_github_username>/X-SCAPE.git
- Add a remote pointing to the public X-SCAPE repository. This will allow you to keep your fork updated in case there are updates to the X-SCAPE public repository while we are developing our code. Let's also rename your fork's remote to make things clear.
You can verify that we now have two "remotes" available that we can pull from and push to:cd X-SCAPE git remote add X-SCAPE [email protected]:JETSCAPE/X-SCAPE.git git remote rename origin myFork
git remote -v [You should see something like the following] X-SCAPE [email protected]:JETSCAPE/X-SCAPE.git (fetch) X-SCAPE [email protected]:JETSCAPE/X-SCAPE.git (push) myFork [email protected]:jdmulligan/X-SCAPE.git (fetch) myFork [email protected]:jdmulligan/X-SCAPE.git (push)
- Create a new development branch (let’s call it "dev") and add your commits:
git checkout -b dev # create a new local branch called "dev" ... git commit -m "my brilliant commit"
- Pull in the latest changes from the public X-SCAPE repository, and then push your changes to your fork:
In case you are doing long-term developments, you should repeat this step frequently to minimize the chance of merge conflicts.git checkout main git pull X-SCAPE # pull in updates from X-SCAPE to your local main branch git checkout -b dev git pull --rebase . main # pull in updates from your local main branch into your local dev branch # The "rebase" option will keep your commits at the tip of the branch, which keeps an easy-to-manage linear history. ... git push myFork dev:main # push your local "dev" branch to the "main" branch on your remote fork
- Open a pull request via the github webpage.
That’s it! You can repeat steps 4-6 for new pull requests.