+++ date = '2023-08-04T17:36:51-08:00' title = 'Git' toc = true tocBorder = true +++ Status: IP
Creating and Cloning
Creating a new repo
git initcreates .git locally
Cloning an existing repo
git clonewill create a replica of an existing repository
Local Changes
Staged
- un-staged changes refer to changes that have been made to files in the working directory yet marked to be included in the next commit.
- staged changes refer to changes that have been marked to be included in the next commit.
Add
git addwill add changes to the staging area
Status
git statusto list all new or modified files
Diff
git diffto view changes between staged files and unstaged changesgit diff --cachedto view changes between staged files and the last commit
Remove
git rmto remove files from the working directory and staging area
Commit
git commit -m "<msg>to commit changes to the repository
History
git logto view commit history
remotes
- remote repositories are versions of the repository that are hosted on the internet or network somewhere
git remote -vto view remote repositories
Pull
git pullto fetch and merge changes from the remote repository
Push
git pushto push changes to the remote repository