Git

Important Git command

GIT add all images

STEP 1:
git add **/*.jpg \*.jpg **/*.gif \*.gif **/*.png \*.png
STEP 2:
git commit **/*.jpg \*.jpg **/*.gif \*.gif **/*.png \*.png -m "Image commit"
STEP 3:
git push --all

GIT add PDF

STEP 1:
git add **/*.pdf \*.pdf
STEP 2:
git commit **/*.pdf \*.pdf -m "Image commit"
STEP 3:
git push --all

GIT Add Single File

STEP 1:
git add <file_name>
STEP 2:
git commit <file_name> -m "comment"
STEP 3:
git push

GIT Merge

STEP 1:
git fetch --all
//git fetch downloads the latest from remote without trying to merge or rebase anything.
STEP 2:
git reset --hard origin/master
//Then the git reset resets the master branch to what you just fetched.

Clean Aborting

git reset --hard HEAD
git clean -f -d
git pull

 

Git Export tar.gz  Archive

// Show All Revision Number: $ git log --all --graph --oneline
//Export All Files Between 2 Date
//git log --since --before
tar czf changed-files.tar.gz $(git log --after={2013-06-17} --name-only --pretty=format: | sort | uniq)
//Export All Files Between 2 Commit
tar czf changed-files.tar.gz $(git log ^46a2752 6d365ed --name-only --pretty=format: | sort | uniq)

GIT  Reset Previous Commit

STEP 1
git log
/* 
commit f81c44262661d977250086ebd59e4427a9085c47
Author: iman <iman@bitmascot.com>
Date:   Fri Feb 7 14:46:14 2014 +0600 
*/
STEP 2
git checkout master
STEP 3
git reset --hard f81c44262661d977250086ebd59e4427a9085c47
STEP 4
git stash
git push -f origin master:master
git stash pop
// If you want to throw away all your changes on master and want to have it exactly the same as origin/master
git checkout master
git reset --hard origin/master

GIT  Reset Previous Commit

STEP 1:
git reflog show
/*
Result:
edbfd0d HEAD@{0}: commit: Import code from development environment.
da39602 HEAD@{1}: checkout: moving from master to development
*/
STEP 2:
git reset --hard da39602