🧠
BRIDGE Lab Documentation
  • BRIDGE Lab Documentation
  • 📘General
    • About Us
    • Onboarding
      • First Steps
      • Research Specialist Training
      • Project Coordinator Training
    • Misc
      • How to do misc things
      • Burning Scans to a Disc
      • Setting Up Meetings in the Conference Room
      • Printing
    • Imaging Glossary
  • 🖇️Admin
    • Ourday
    • Training
    • Regulatory
    • Social Media
    • REDCap
      • Archiving REDCap Projects
  • 🖥️Tech
    • Setting Up Meetings in the Conference Room
    • Lynx Machines
    • Surplus Computers
    • Effective Troubleshooting
    • Remote Work Resources
    • Arthur
    • Servers
      • Connecting to an External Server
    • Bash 101
      • What is Bash?
      • Bash Examples
      • How to add elements to your bash profile
    • git and Github
  • 🩻Image Acquisition
    • ViSTa
  • 🗃️Data Organization
    • BIDs Data Formatting
    • MRI Data Organization
  • 🖼️Image Analysis
    • Image QC
      • Raw Data QC
        • Diffusion QC
        • T1/T2 QC
        • ViSTa QC
        • Spectroscopy QC
      • PyDesigner QC
    • Project Lifecycle
    • General Concepts
    • Raw Data
    • Preprocessing
      • Denoising UNI MP2RAGE Images
      • PyDesigner
      • ViSTa
    • Native Space Analysis
      • TractSeg
        • TractSeg + Within-Subject Registration
      • Segmentation
        • LST
        • Freesurfer
        • NOMIS
    • Registration
      • DTI-TK
      • TBSS
      • Coordinate Systems
    • Other Pipelines
    • Archiving
  • 📊Data Viz and Stats
    • Plotting in R
  • 📚Imaging Library
Powered by GitBook
On this page
  1. Tech

git and Github

Last updated 7 months ago

Git is a version control software. This means that it allows you to make changes to files (be they text files, scripts, spreadsheets, etc) while git keeps a log of the changes. While it is not necessary to use git with every project you do, it is worth getting familiar with git so that you can use it for bigger projects and group projects.

Github is an online host for files tracked via git. It is very useful for group collaboration on a project and for storing commonly shared files (such as the set of documentation this document is part of).

Git can be downloaded for Windows and for Mac .

In order to use Github, you will need to make on account on .

You can read more about getting started with git and Github .

Initializing and updating a project with git and Github works as follows:

Let’s assume you are developing an analysis pipeline which involves updating a main script as you test it as well as all of the documentation and accessory files and functions that make the program run.

  1. cd into your main project folder where all of your files are stored.

  2. Use the command git init to initialize git in your folder. This creates a hidden file called .git which will track all of your file changes.

  3. You will then git add and git commit any changes you make to your files, which will work like this:

    1. You make changes to your code which is store in a file called, for example, my_code.py

    2. You use the command git add my_code.py which will tell git that you’ve made changes to the file in question and you want to add those changes into a staging area. This is a temporary space where git is recognizing changes you made to your files.

    3. You then use the command git commit -m “Updates my_code.py” which tells git to commit these changes to a change log. The “-m” indicates that there is a message the follow. A brief message of what was changed should go in quotes after the “-m”.

  4. If you would like to track all of your changes and store your files in Github, you will need to do the following:

    1. Go to Github and click the green button at the top of the page labeled “New”

    2. Enter your repository name as prompted. This can be anything you want.

    3. Select if you’d like this to be a private or public repository. If you will be working with other people on this project, it should be public.

    4. Click “create repository”

    5. On the next page you will have two options:

      1. If you had no local repository (a project folder on your local computer), the first option “…or create a new repository on the command line” gives you the commands you need to set up a new local repository

      2. If you already have a local repository set up (which you do if you followed steps 1-3), you can use the commands from the second options: “…or push an existing repository from the command line”. This will tell Github to look at files from your local project folder and your local .git file and copy those files and change log to Github.

    6. When you make future changes to your files locally, after you git add and git commit those changed, you can then use git push to push the changes to Github.

🖥️
here
here
github.com
here