-
Notifications
You must be signed in to change notification settings - Fork 43
Git Basics
If you've already worked through the Getting started as a JCrypTool Developer tutorial you have the four JCrypTool-Git repositories, core, crypto, tests and doc on your PC, in your local git repository. Now the question arises, how do I get my changes back to the JCrypTool repository on GitHub. The two main steps for this, committing and pushing, are explained here.
In this tutorial the graphical user interface (GUI) of built-in git client in Eclipse RCP is used.
Committing using the GUI of the built-in git client in Eclipse RCP is quite simple. Right-click on a plugin, folder or class, then select Team -> commit.
You will see three fields, Unstaged Changes, Staged Changes and Commit Message. In Unstaged Changes, you see all the files you've changed. To commit files, drag and drop them into the Staged Changes field. Then enter a comment in Commit Message on what you have changed. Commit your changes by pressing commit.
Note: Your changes are not yet on your fork or in the JCrypTool repository. See the next chapter to learn how to push the committed changes onto your fork.
You can push your committed changes to your fork by right-clicking on the repository in the Eclipse repository explorer. Then you choose Remote ... -> Push ....
A dialog will open in which you must select the destination repository. There you select your fork and click on Next. On the next page you decide which local branch should be pushed into which branch on your fork. Select the appropriate branches in the group "Add create / update specification" and press Add Spec. By clicking on Finish all committed changes will be pushed onto your fork.
You can create a Pull Request (PR) by pressing New Pull Request on the main page of your Fork in GitHub. As base fork, for instance jcryptool/crypto should be selected, as base branch there develop. As head fork select your fork of the the jcryptool repository, as compare select the branch you made your changes in.
Give your Pull Request a title and enter a description, so that others can recognize the changes.
For more information see: https://help.github.com/articles/creating-a-pull-request/
Keeping your GitHub fork up to date requires two basic steps. First, you need to bring your local repository up to date. Then you must push the changes onto your GitHub fork.
To bring your local repository to the current state of the jcryptool/crypto repository, right-click on the crypto repository in the git repository explorer. Then press Remote ... -> Fetch ... and select the jcryptool/crypto repository.
The default settings for the Fetch Ref Specifications can be left that way. With a click on Finish the changes made in jcryptool/crypto are downloaded to your PC.
To merge the downloaded changes into your current branch, right-click on the crypto repository, press Merge ... -> select the jcryptool/crypto develop branch (in the Remote Tracking category) and press Merge.
Your local repository is now on the same status as the jcryptool/crypto repository.
To bring your GitHub fork up to date, push your clone to your fork. You do this by right-clicking on the crypto repository in git repository explorer -> Remote ... -> Push ....
In the appearing dialog select your fork -> click on Next. As source-ref, select the branch you want to push. As Destination-ref, select the branch you want to push into. Press Add Spec, then Finish.
Your current branch will now be uploaded to your fork. Your fork is now even with jcryptool/crypto.
Need help? Please visit the public JCT Chatroom or open a new Issue and ask your question. We'll be happy to assist you!