Research laboratory workshop files for the Video and Image Processing Lab (VIP) of the National Institute of Physics (NIP-UPD).
Changes in a repository are always tracked. This is useful when multiple people are working on the same workspace editing at the same time. Unlike google docs or other live collaboration software, the approach to git follows a structure.
Add changes (git add) -> Finalize changes (git commit) -> [Optional] Synchronize changes from online repository (git pull)
Here the a link for a github quickstart guide. Additionally, this is not covered in this workshop but this shows how to work on files locally then upload then synchronize them automatically on GitHub.
The flowchart above shows the typical flow of a repository. Changes are usually done in other branches before merging to the main branch that serves as the release for the public. Branches are not fixed and the use depends on the workflow but typically there is a 'development' branch that shows minor incremental changes that still get tracked like bug fixes or part of a feature. These branches are typically not available to the public as further testing is required for the code to be stable. Once the changes in this branch are considered to be done then it can finally be merged to the 'main' branch for the final release.
For a basic overview, we will be doing this from the GitHub website and the GitHub desktop app for a convienient user experience. Experienced users may opt to do this in shell.
- Create GitHub account
- Download GitHub Desktop
Request collaborator access first. Then from GitHub website,
- Click on the
Add File > Upload Files
then upload necessary files - Add a descriptive text on the changes made i.e.
added github workshop files
- Make sure to toggle the make a new
Create a new branch for this commit and start a pull request
. Then create a name for this branch. This takes you to the pull request page. (It is good practice to make changes in another branch then merge it with the main branch after) - Put a title then click
Make Pull Request
. This allows to administrator to review changes before pushing changes to the main branch. - Wait for the pull request to be approved.
Using GitHub Desktop,
- Sign in using GitHub account
- Click
Clone a repository from the Internet
, go to URL tab and input the repository linkhttps://github.com/InterstellarMist/VIP-Workshop-2024.git
Using CLI
Setup git in your local machine. Make sure to set the git config
git config --global user.name "username"
git config --global user.email "email"
Then clone using https
git clone https://github.com/InterstellarMist/VIP-Workshop-2024.git
For SSH, follow the steps below
- Generate passkey using
ssh-keygen -t rsa -C "email"
- Upload ssh public key to GitHub. Go to
profile settings > SSH and GPG keys > New SSH key
. Copy the generated key. - Add a title
Dell XPS 15 Laptop
and paste the key. - Test the SSH connection using
ssh -T git@github.com
- After making changes:
git add .
. This puts all modified and created files on the staging area, for commit. - Commit changes:
git commit -m "Message"
. This finalizes the change as a new version or state. The message should be short but descriptive like "uploaded neural network code output". - Pull from source first:
git pull
. This ensures that your local repository is synchronized before uploading to the remote repository. Resolve conflicts by merging, or manually fixing. - Push changes to the remote repo:
git push origin main
Summary:
git add .
git commit -m "Message"
git pull
git push origin main