=> git config --global user.name "Sunil Ghimire"
=> git config --global user.email "info@sunilghimire.com.np"
=> git config --list
=> git help
=> git help <topic>
=> git init
=> git add filename
=> git add filename1 filename2
=> git add . To Add All Files In Directory
=> git commit -m 'Short and Sweet Message'
=> git commit -am 'Staging and Comit Directly'
- Separate subject from body with a blank line
- Limit the subject line to 50 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use the body to explain what and why vs. how
=> git clone <project_url>
=> git status
=> git status -s [Short Status]
=> git diff [ Find difference between commited and unstaged files]
=> git diff --staged [difference in staged files]
=> git rm filename
=> git mv file_from file_to [If we rename the file]
=> git reset HEAD
=> git reset HEAD file1.txt
=> git checkout filename
=> git log
=> git log --oneline [Oneline Easy and Fast]
=> git log --stat [More History]
=> git log --pretty=oneline [Show SHA1 Value]
=> git log --pretty=format:"%h %s" --graph
=> git log --pretty=format:"%h - %an, %ar : %s"
=> git log --since=2.weeks
=> git log --after=2.weeks
=> git log --author "Sunil Ghimire"
=> git log --oneline --decorate --graph --all
=> create .gitignore file
=> then add filename/foldername line by line
=> *.c => ignore al .c files
=> !main.c => not ignore main.c file
=> node_modules/ => Directory node_modules and all files inside it.
=> git restore
=> git restore --staged file1.txt
=> git remote show origin [To View Remote Origin Details]
=> git remote -v
=> git remote add origin :
=> git push origin master
=> git pull => pull data with current head
=> git fetch => only download the data to local repository
=> git fetch origin mod => To retrive remote branch
=> git remote rename pb paul
=> git remote remove paul
=> git push origin --delete bad-branch-name
=> git tag -l
=> git tag --list
=> git tag -a v1.4 -m "my version 1.4"
=> git show v1.4
=> git tag v1.4-lw [Lightweigt]
=> git tag -d v1.4-lw
=> git checkout v2.0.0
=> git push origin .
=> git branch testing [To Creating Testing Branch]
=> git checkout testing [Switch Branch]
=> git commit -am 'made a change'
=> git checkout master [To Move to Master Branch]
=> git checkout -b .[Creating branch and switching to it]
=> git branch --merged
=> git branch --no-merged
=> git branch --move bad-branch-name corrected-branch-name
=> git reset
=> git reset SHA1
=> git reset -hard SHA1
=> git stash save
=> git stash list
=> git stash pop
=> git stash apply stash{0}
=> git stash clear
=> git stash grop stash
=> git merge branchname
=> git merge --no-ff branch name
=> git rebase branchname
=> Imagine you get some paper and crayons for your birthday.
=> You use them to yourself a nice beach scene. Then you go have a nice sandwish for lunch.
=> When you come back, you start to draw some seagulls - but shit, the food coma hits and thet look terrible!
=> So, you crumple up the paper in anger, throw it on the floor for mommy to clean up, and you start over from scratch, re-drawing the beach scene, then trying the seagulls once more, after you finish crying, of course.
=> Wouldn't it be nice if instead, mommy could reach into the closet and pull out an exact copy of the beach scence before you want to lunch?
That way, you just get right back to the seagulls and not have to re-do all the work before that print.
=> That's essentially Git
(except that YOU can go into the closet yourself and mommy can continue to lay on the counch enjoying her coffee- that's how everyone's childhood was, right?!)
=> With Git though, it's code.. You create a file
, You edit it a bit
, Then, you **"Commit"** it to Git
=> Without getting into the inner workings, there is essentially from your perspective anyway, a copy of the file exactly as it was at the time you commit it.
Make Some changes commit it again, now there's two couples (two "versions") that look like the file at the same time of each commit.
=> These copies are the file's "history". You can compare two different versions to see what changed, and you can "revert" you own copy to a previous change, just like our bratty own artist.
Figure 01: Awesome notes on git commands
Figure 02: Awesome notes on git commands
Figure 03: Awesome notes on git commands
Figure 04: Awesome notes on git commands