Git Bash Help - Autonomous-Motorsports-Purdue/Electrical_Documentation GitHub Wiki
This document will try to outline the process of sharing files through git. It is a working document so if there is information presented that you think is incorrect, it probably is :)
cd → this is used to "change directory"
entering this command with no arguments will navigate you to your home directory
cd .. → this will navigate you back to the parent directory
cd /home/user/documents → this will navigate you all the way to this "documents" folder
Note: after you have typed "cd" you can press tab at any time to auto-complete the directory that you are trying to change into. (ex: start typing cd docu turns into cd documents
ls → this will "list" all of this files in the current folder
ls - a → this will list all files, including hidden files in the current folder
ls -l → this will list all files, as well as their most recent edit time, and their current permissions
pwd → this will "print working directory" aka show you the current file path that you are in
mkdir → this will create a new directory in the current folder
rmdir → this will remove a directory if it's empty, and warn that it's not empty if not empty
rm -r → this will remove a directory and all of its contents if there are items inside it (however, it will ask for confirmation on every item)
rm -rf Does the same as rm -r, except doesn't ask for confirmation on anything
navigate to the location that you want to download the git files in your file system (documents folder...)
git clone <https://github.com/username/repo.git> → use the URL for the AMP GitHub to clone this into your local computer
git reset --hard origin: will make your files look like they do on GitHub
moving files to a different directory in git: tutorial link
move files on computer
git add .
git status → check to make sure that it says rename not delete and create new stuff
git commit -m "message here"
git push origin
For a fuller git rundown, check the slides here
-
pull from Github (updates your files with the online repository) → git pull origin
-
DO THIS BEFORE YOU START WORKING AS IT WILL CLEAR ANY OF YOUR LOCAL CHANGES
-
make changes (using kicad, coding, etc.)
-
as you go you commit the files using -m to describe the changes you have been making
-
git status -> shows untracked files
-
git add → add the files to git
-
git add . → will add all of the tracked files (use this only if you know you want to add everything
-
git add * → will add all files, including untracked files (don't use this unless you really want to add a brand new file to the GitHub)
-
git commit -m ""
-
Note you can commit files multiple times before pushing. The push is like your final check off from working. Commit often, Push only once in a while
-
git push origin
(feel free to add new ones as you go)
git show → shows detailed information about the last commit