Windows: Download and install Git from git-scm.com.
Linux: Open a terminal (ctrl+alt+T) and type:
sudo apt install git
C:\Program Files\Git\git-bash.exe
. You can also rmb click in windows explorer and open Git bash here
.cd /path/to/where-you-want-to-store-your-git-repository
git status
. If this is not yet a git repository, we can initialize one.git init
Setup the .gitignore and .gitattributes (for git lfs).
Add the files that you want to track:
git add file
# or
git add ./folder # to add a whole folder
# or
git add -A # to add all untracked files, do this only after you set up your .gitignore
Do your initial commit
git commit -am "Initial commit" # commit all staged files with msg "intial commit"
git log # check to see if your commit was logged
git branch -M main # change branch name to main
git remote add origin https://gitcloudservice.com/account/reponame.git
git push -u origin main
What is the basc workflow, when you want to add a new feature or fix a bug for an existing project?
git checkout master
git pull
git branch ALR_calculate_answer_universe
git checkout ALR_calculate_answer_universe
git add your_files.cpp
git commit -m "feat: added tool to caluclate the answer to the universe and everything"
git push origin ALR_calculate_answer_universe
git commit --ammend
git config --global core.editor "nano"
git pull origin main --allow-unrelated-histories
You might not want to track every file in the repository (for example generated results, or cache files), to exlude files from being tracked, run
git ignore
Git Large File Service may be helpful if your project involves stuff like video’s, audio files, large textures or any other large files.
git lfs install
git lfs track "filename(s)"
git lfs track "*.mp3"
.gitattributes
file (check if it was created by typing git status
). git help credential-cache
git config --global credential.helper 'cache --timeout 3600'
You may want to add submodules as part of your repository. This will allow you to use other repositories as part of your own, by linking it directly (keeping things maintainable and preventing double work).
git submodule add <remote_url> <destination_folder>
git pull --recurse-submodules
git submodule deinit <submodule>
git rm <submodule>