artdvp
9/7/2017 - 3:13 PM

Git Command line

$ git init
$ git status
$ git add octocat.txt
$ git commit -m "Add cute octocat story"
$ git add '*.txt'
$ git log
$ git remote add origin https://github.com/try-git/try_git.git
$ git push -u origin master
$ git pull origin master
$ git diff HEAD
$ git reset octofamily/octodog.txt
$ git checkout -- octocat.txt
$ git branch clean_up
$ git checkout clean_up
$ git rm '*.txt'
$ git commit -m "Remove all the cats"
$ git checkout master
$ git merge clean_up
$ git branch -d clean_up
$ git push

$ git help <command>
$ git config --global user.name "AChai"
$ git config --glbal user.email "mail@mail.com"
$ git config --global color.ui true   >> Pretty command line colors

$ mkdir store
$ cd store

$ git init

$ git status
$ git add --all
$ git commit -m "Add license adn finish README"
$ git log

$ git add <list of file> >> Add the list of files
$ git add --all >> Add all file
$ git add *.txt >> Add all txt files in currnet directory
$ git add docs/*.txt >> Add all txt files in dics directory
$ git add '*.txt' >> Add all txt files in the whole project

deploy project to gh-pages
git subtree push --prefix dist origin gh-pages

Change the author and committer name and e-mail of multiple commits in Git
ref : http://stackoverflow.com/questions/750172/change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-git 

#!/bin/sh

git filter-branch --env-filter
'OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then   
     export GIT_COMMITTER_NAME="$CORRECT_NAME"   
     export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then   
     export GIT_AUTHOR_NAME="$CORRECT_NAME"   
     export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags

Changing a remote's URL

$ git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git

Git show config
$ git config --list

Git show remote

$ git remote show origin