Github: Terms
Github: Terms
Github: Terms
Terms
Directory: is a folder
Terminal or Command Line: interface for text commands
CLI: Comand Line Interface
Cd: Change Directory
o cd c:/users/lamar/documents/’my bootcamp’/projects/’learning git’
NOTE, if you have a space in the file name, use ‘ ‘.
Code Editor
Repository: a project, or folder/place where your project is kept
Github: the website where you host you repositories online
Git Commands
Clone: bring a repository that is hosted somewhere like github into a folder on your local
machine (download a project)
Add: track your files and changes in Git
Commit: Save your files in Git
Push: upload Git commits to a remote repo, like github
Pull: Download changes from a remote repo to your local machine, the opposite is push
In Github, create a new repo (+ icon on the top right). All repos need a markdown file called
“readme.md” file to describe the project – what it’s about, what it does, and any other relevant info.
NOTE: shortcuts/formatting:
Use # to represent a header (IE: # Demo)
Git commands:
Getting help:
o Git config -h -> Gets a list of commands in the terminal
o Git help config -> Get a website with all the info (like mdn but for git)
o Git help log, git help add, git help _____
Clear – clears all terminal history
git config Set username and email to track my contributions
o Git config -–global user.name “Ben Lamarche”
o Git config –-global user.email lamarche.w.benjamin@gmail.com
Set default branch name to main
o Git config --global init.default branch main
NOTE: Master is the default, but is no longer best practice. We should use main
moving forward. If you need to change the name of the master branch:
git branch -m master main
Check on the status of the git branch
o git status
cd: Change Directory
o cd c:/users/lamar/documents/’my bootcamp’/projects/’learning git’
NOTE, if you have a space in the file name, use ‘ ‘.
git init: git initialize
o git init
Note: this should create a hidden .git folder in the directory (windows explorer,
view > show > hidden
Git status: to get the status of this git repository (which files are (not) being tracked)
o git status
setting which files are and aren’t tracked in the repo
o ADD – we are adding files to the WIP folder (aka staging). Committing saves them to
the main depo – the way it works is…. Working files get added to the staging which
then gets committed to the repo
Git add filename - > git add index.html
Git add --all -OR- git add A -OR- git add . to track all files
o REMOVE
Git rm --cached filename -> git rm --cashed index.html
o Ignoring files we don’t want to track. (for confidential info, or log records…)
Create new text document
Name .gitignore
o Add a comment with the # and then add a list of all the files you
want to ignore IE:
# ignore all .txt files
*.txt * for all files (wildcard)
Salary.doc
www.Github.com/github/gitignore for more info
Commit
o Git commit -m “a note to go along with the commit” note, the -m is for message
NOTE: Check on git status, you’ll see no files or tracking. But update a file, and
you’ll see there are now updates on the status of the changed files
o git commit -a -m “notes about commit” <- -a for all, -m for modify
in the terminal type in
Git log
o See all commits
o git diff to see all changes for the entire history
-c = create
-m = message
-rm = remove
-mv = move (or change – IE change file name)
o git -mv “index.html” “home.html” changes index to home.
git log -p (print git log – will show all the history and what actually changed over the history)
o press q to exit
Create a file
o Touch FILENAME+EXTENSION
Quick setup — if you’ve done this kind of thing before
Set up in Desktop
or
HTTPS
SSH
git@github.
Get started by creating a new file or uploading an existing file. We recommend every repository
include a README, LICENSE, and .gitignore.
…or create a new repository on the command line
echo "# Udemy-Jonas-S.--Web-Dev-Blog" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:LamarcheB/Udemy-Jonas-S.--Web-Dev-
Blog.git
git push -u origin main
…or push an existing repository from the command line
git remote add origin git@github.com:LamarcheB/Udemy-Jonas-S.--Web-Dev-
Blog.git
git branch -M main
git push -u origin main
…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.
Import code
git add .
// or files specifically
git status
// double check to make sure you’ve added the files you want to commit