In this page you will find information on how to use gitlab in general and for our Epilepsy project in particular. Gitlab is a web based Git repository that provides an opportinty to develop a streamlined project workflow. It is a cloud based sharing center where users working on the same code can compare, develop, pull and push code to the master repository.
Git Useful Links
Steps to create a gitlab repo
Go to the git lab login page and create a project. If you already have files you can push them using command line instructions below. Otherwise you can start with adding a README, a LICENSE, or a .gitignore to this project. You will need to be owner or have the master permission level for the initial push, as the master branch is automatically protected.
Command line instructions
Git global setup
git config --global user.name "C Ustine" git config --global user.email "firstname.lastname@example.org"
Create a new repository
git clone email@example.com:candidaustine/Name_Of_Project.git cd Name_Of_Project touch README.md git add README.md git commit -m "add README" git push -u origin master
cd existing_folder git init git remote add origin firstname.lastname@example.org:candidaustine/Name_Of_Project.git git add . git commit -m "Initial commit" git push -u origin master
Existing Git repository
cd existing_repo git remote add origin email@example.com:candidaustine/Name_Of_Project.git git push -u origin --all git push -u origin --tags
Basic GitLab commands
Go to the master branch to pull the latest changes from there
git checkout master
Download the latest changes in the project. This is for you to work on an up-to-date copy (it is important to do every time you work on a project), while you setup tracking branches.
git pull REMOTE NAME-OF-BRANCH -u (Ex: git pull origin develop-v1)
(REMOTE: origin) (NAME-OF-BRANCH: could be "master" or an existing branch)
Create a branch. Spaces won't be recognized, so you need to use a hyphen or underscore.
git checkout -b NAME-OF-BRANCH
Work on a branch that has already been created
git checkout NAME-OF-BRANCH
To List the name of the branch that you are working on
To List the name of the remote
View the changes you've made. It's important to be aware of what's happening and what's the status of your changes.
Add changes to commit. You'll see your changes in red when you type "git status".
git add CHANGES IN RED git commit -m "DESCRIBE THE INTENTION OF THE COMMIT"
Send changes to gitlab.com
git push REMOTE NAME-OF-BRANCH
Delete all changes in the Git repository, but leave unstaged things
git checkout .
Delete all changes in the Git repository, including untracked files
git clean -f
Merge created branch with master branch. You need to be in the created branch.
git checkout NAME-OF-BRANCH git merge master
We have created a repository of the connectome scripts written and managed for the ECP project. The ECP project is a private repository managed by the ECP MEG team at MCW.
We have currently created two branches of the existing code obtained from the HCP megconnectome database. The "master" branch is our main branch and will only be accessed when we would like to make permanent edits to our code. The developers in the project wil be working on the branch called "develop-v1" which will be our workspace where we store temporary code during trial & development stages. Developers, please pull a copy of the code from the "develop-v1" branch to your workstation to work on the most updated version of the code.
Pull from ECP Repository
git clone firstname.lastname@example.org:candidaustine/epilepsy_megconnectome.git OutputDir