-
Notifications
You must be signed in to change notification settings - Fork 3
How to GIT
The whole project is developed for a GIT usage. If you are not familiar with git or how to commit, try the following tutorial first, to learn basic git commands: Interactive Tutorial
Furthermore it's necessary to understand the basic git flow or structure of this project, as multiple people are working on it at the same time.
The best practice for structuring a project is the following Git branching model.
Basically it says, that each repository should have two main repositories master and develop, and several feature branches, which get merged into the develop branch and the develop branch himself gets merged from time to time in the master, if it's considered stable.
This workflow SLIGHTLY ADAPTED is also used for VALID as it proved to be them most successful for collaborating teams. As it's a relatively small project, with only a few contributors so far, we are currently omitting the develop branch. All development is done on feature branches, which are merged back into the master from time to time. An example workflow is listed below:
- Pull from
masterbranch, which contains always the latest stable version. (Don't commit directly to it! Except in specific cases!) - Create a
feature_XXXbranch, which should start with the keyword feature_. - Work on the feature branch locally and push it to the repository. (See next section for further details)
- After you finished your work on the branch, create a Pull Request which gets merged into the master branch, after a review.
DO's & DON'Ts:
- If you commit to
master, only do it for hotfixes, where you are absolutely sure. - Feature branches start always with
feature_and then the name. - Create a
pull requestfor your feature branch after its finished. - Feature branches should only be related to one specific issue or one problem.
- More feature branches are better than less.
- As issues is created, make sure labels are assigned correctly.
- Try to help others with bugs and review code.
- Assign issues to persons who can fix them reliantly.
It's recommended to use PyCharm for the commits, as it offers the best possibilities for version control and message committing. Before you commit make sure there are no errors and write a meaningful, but short message in one of the following formats: For a single change, which either references an issue or closes it.
Fixes Bug XXX and implements (refs #IssueNr.) (closes #IssueNr.)
For multiple changes, which fixed various stuff.
Multiple Changes:
* Fixes Bug XXX (refs #IssueNr.)
* Removes XXX (closes #IssueNr.)
etc. ...
Before we show an example commit with PyCharm and the workflow behind it, we would like to show you some useful tips and commands, when working in the command line with git.
- If you are in a git directory or workspace of an git project, you can use the following command to get a basic information about the current state of files (changed, excluded, ready to commit, etc.).
git status
- To add a new created file to the git tracking (if not done automatically by your IDE) you need to do it with the following command.
git add exampleFile.txt
- Once files are changed they are in the staging area, where they still can be removed from the commit or reverted. In order to commit the files and changes, type the following, with a meaningful message.
git commit -m "Added XXXX and Fixed XXXX"
- If you want to add multiple files of the same type, you can use wildcards.
git add '*.txt'
- To browse the history of changes git also offers a handy feature, which is called the git log.
git log
- The
pushcommand tells git where to put the local files on the remote repository and which branch. The example pushes the files to theoriginbranch of the remote repo.
// -u tells git to remember the branches so we can use next time just git push
// origin is where we push
// master is the name of the local branch we are on
git push -u origin master
- To get the latest changes you need to
pullagain from the repo.
// orgin is the remote branch where we pull from
// master is the name of the local branch we pull into
git pull origin master
- To view the changes of the most recent commit, compared to the current branch we can use the following command. To point to the most recent commit, we use the HEAD command.
git diff HEAD
- Another great use for the diff is to see the changes to
stargedfiles (the files which are in the pipeline for commiting).
git diff --staged
- Files can be removed aka
unstagedby using a reset command.
git reset exampleFile.txt
- Files can also be changed back to what they have been before, by using the
checkoutcommand, as unstaging them only removes them from the commit pipeline.
git checkout --exampleFile.txt
- In order to create a new working branch, which later can be merged into the master branch, you can execute the following command.
git branch branchName
- After merging a feature branch into the master or main branch, you should clean it up.
git branch -d branchName
By using the IDE PyCharm, we have the advantage of having an integrated VCS (Version Control System). The system is well integrated into the IDE and will be explained shortly here. For more details, research on Pycharm and git usage. Here only the most important workflow for VALID will be shown in a showcase video.
- Requirements
- Installation
- Updates to the framework
- Framework
- System and Architectures used
- SPECIALITIES of Phovea
- How it works
- How to commit
Added Features Libraries Architectures
- Multiple .....