My Docs
My Blog
Python Data Structures
Repo
Family-Promise-Docs
Search…
Web-Dev-Hub-Docs
Home
Navigation
Tools
Tools
Showcase
Downloads
How To Configure Ubuntu
REPL.IT Compilations
Past Notes
Git
JavaScript
Programming Languages
Programming Languages
What is a Programming Language?
Python
Python
Install PIP
JavaScript
JavaScript
JS-Leetcode
Web Development Frameworks & Libraries
GRAPHQL
React
Jquery
GATSBY
Productivity
Productivity
Misc
Misc
GitGateway
Links
Bookmarks
Websites
Websites
Not My Websites:
Backend
Backend
Networking
Networks
Resources
Resources
Video Resources
General Knowledge
General Knowledge
Knowledge Bank
Finance
Finance
Finance Reference
Financial Trends
Science & Tech (Innovation)
Science & Tech
Articles
Reading
Reading
Social Media & Trends
Trends In Web Dev
FB-Dev-Open Source
IG-API
Docs
Docs
Code Editors & Tools
Vscode
Cool Stuff
Cool Observable Notebooks
Server-Side
GraphQL
Rest VS GraphQl
REST-API
Public APIs
WEB_DEV_TOOLS
Web Dev Tools
Cloudinary
Postman
Netlify
DS_ALGOS_BRAINTEASERS
A Quick Guide to Big-O Notation, Memoization, Tabulation, and Sorting Algorithms by Example
Free-Stuff
Free Stuff
Job-Search
Job Search
Outreach
General Comp Sci
Principles behind the Agile Manifesto
Blockchain & Crypto
Blockchain Basics
Data Structures & Interviewing
Data Structures
REACT_REVISITED
Modern React with Redux
WEBDEV-Bootcamp-Notes
Lambda
Group 1
Testing:
Medium-articles
My Articles
Powered By
GitBook
Git
​
git init
Converts a local directory into a Git Repository
git status
See what is being tracked by Git within a Repository
git add .
[file] [file] [file]
*.txt
Add everything within the directory to the repo
Add specific files to the repo
Add All txt files to the repo
git commit
A snapshot of all the files in the directory (repo)
git commit -m "<message>"
Write a message that describes the commit
git commit --amend
Alter the latest commit
git diff
--staged
<commit>
<commit>^!
<from commit> <to commit>
See the changes within the working directory
See the changes in the Staged Area
See the changes within a specific commit
See the changes between a specific commit and the commit before it
See the changes between 2 specific commits
git branch …
Creates a parallel commit
git checkout …
Changes where HEAD is
git checkout -b …
Creates a parallel commits and moves HEAD there
git merge …
Merges parallel branches
git rebase …
Takes a set of commits, copies them, and puts them down somewhere else
Keeps a cleaner commit log / history of the repository
git log
Used to see hashes
^
Move upwards one commit (per ^)
~<num>
Move upwards a number of times (don't use <> )
git branch -f master HEAD~3
Directly reassign a branch to a commit
(moves the master brand to three parents behind HEAD)
git reset …
Reverse changes by moving a branch reference backward to an older commit
Used for local git repos
git revert …
Reverse changes and share those reversed changes with others
Used for remote git repos
git cherry-pick <commit> <commit> <commit>
Copy a series of commits below your HEAD
git cherry-pick <source>..<destination>
Copy a specific commit source to a specific branch destination
git rebase -i
Open up a UI to show which commits are about to be copied below the target
Shows their commit hashes and messages
Ability to do 3 things:
Reorder commits by changing their order in the UI
Choose to completely omit some commits
toggling pick off means you want to drop the commit
Squash commits… essentially allows you to combine commits
git tag v1 c1
Permanently mark "milestones" that can be referenced like a branch
CANNOT change what is in the tagged commit
Tags exist as anchors in the commit tree that designate certain spots
Tags commit 'c1' as the 'version 1' prototype
if the commit is left off the command… then the Tags is placed on the HEAD
git describe <ref>
Where you are relative to the closest "anchor" (aka Tag)
Useful when you need to get your bearings after moving too much within a commit tree
<ref> can be any commit
If <ref> is left out of the command, the default is HEAD
Output command:
<tag>_<numCommits>_g<hash>
<tag>: Closest anchor in history
<numCommits>: How many commits away that anchor is
<hash>: The commit being described
git checkout HEAD~^2~2
^<num> will choose a different branch when trying to move upwards from a merged commit.
No number will move upwards directly above the merge.
^<num> will move up the next closest branch
~<num> moves up from the lowest commit within that branch
Previous
Command Line Reference
Next - Tools
JavaScript
Last modified
2d ago
Copy link