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 \*.pdfSTEP 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 HEADgit clean -f -dgit pull |
Git Export tar.gz Archive
// Show All Revision Number: $ git log --all --graph --oneline//Export All Files Between 2 Date//git log --since --beforetar czf changed-files.tar.gz $(git log --after={2013-06-17} --name-only --pretty=format: | sort | uniq)//Export All Files Between 2 Committar czf changed-files.tar.gz $(git log ^46a2752 6d365ed --name-only --pretty=format: | sort | uniq) |
GIT Reset Previous Commit
STEP 1git log/* commit f81c44262661d977250086ebd59e4427a9085c47Author: iman <iman@bitmascot.com>Date: Fri Feb 7 14:46:14 2014 +0600 */STEP 2git checkout masterSTEP 3git reset --hard f81c44262661d977250086ebd59e4427a9085c47STEP 4git stashgit push -f origin master:mastergit stash pop |
// If you want to throw away all your changes on master and want to have it exactly the same as origin/mastergit checkout mastergit 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