Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
17 views6 pages

Github: Terms

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 6

Github

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

Working with branch


 Create a new branch: git branch NAME
 Pull a list of all branches: git branch
 Switch between branches: git switch BRANCHNAME
git switch -c BRANCHNAME (this’ll create and switch to new
branch)
o NOTE: in file explorer, you’ll see the files only reflect the updates (or lack of updates)
based on the branch you’re current set to in the terminal.
 IE: switch to new branch, make adjustments. In the explorer, you’ll see the
udpates. BUT, now switch back to main branch. Now you wont see the updates.
You’ll see the original info with no udpdates. This will be the cause until you
commit the new child branch (Merge)
 Merge
o Git merge – m “NOTES RELEVENT TO THE MERGE” “BRANCH YOU WANT TO MERGE”
 NOTE: when doing a merge, ensure you’ve switched to the parent branch and
then merge the child.
o After the merge, you’ll want to delete the branch.
 Git branch -d BRANCHNAMETODELETE
Github
 Fetch, merge, and pull
o If working on github and you want to get the updated files on your local machine, you:
 git fetch – to get all the updated files
 git merge – to merge
 OR
 You can just do a git pull

Agent pid 1812


$ ssh-keygen -t ed25519 -C "lamarche.w.benjamin@gmail.com"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/c/Users/lamar/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase): Hello2u212
Your identification has been saved in /c/Users/lamar/.ssh/id_ed25519
Your public key has been saved in /c/Users/lamar/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:ZFq8HV7kyJ9gYj2Y8q1qLnin99Xam3TnQNgqlb+nCNk lamarche.w.benjamin@gmail.com
The key's randomart image is:
+--[ED25519 256]--+
| . |
| . = + |
| . X O o |
| O B * = |
| . S + * o |
| . = + |
| . . = E + .|
| . o +. . * + =.|
| ..Bo.. . =.oo.|
+----[SHA256]-----+

Agent pid 1836

 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

git commit -m “blahblahblah”

git push -u origin main


// to upload to Github

You might also like