�
git config --global user.name "Your Name"
git config --global user.email "email@example.com"
cd /e/
mkdir gitSpace
cd /e/gitSpace/
git init
git add demo.txt
git commit -m "add a demo file"
git status
git diff demo.txt
git add demo.txt
git commit -m "changed demo.txt"
On branch master
nothing to commit (working directory clean)
git log
git log --pretty=oneline
git reset --hard HEAD^
git reset --hard ea3457
git reflog
git checkout -- demo.txt
git reset HEAD demo.txt
git checkout -- demo.txt
rm demo.txt
git rm demo.txt
git commit -m "remove demo.txt"
git checkout -- test.txt
ssh-keygen -t rsa -C "youremail@example.com"
git remote add origin git@github.com:username/demo.git
git push -u origin master
git push origin master
git clone git@github.com:username/demo.git
git branch
git branch <name>
git checkout <name>
git checkout -b <name>
git merge <name>
git merge --no-ff -m "msg" <name>
git branch -d <name>
git log --graph --pretty=oneline --abbrev-commit
git stash
git stash list
git stash apply
git stash pop
git stash drop
git branch -D <name>
git remote -v
git push origin branch-name
git pull
git branch --set-upstream branch-name origin/branch-name
git tag <tag-name> <commit id>
git tag -a <tagname> -m "blablabla..."
git tag -s <tagname> -m "blablabla..."
git tag
git push origin <tagname>
git push origin --tags
git tag -d <tagname>
git push origin :refs/tags/<tagname>
git branch |grep 'searchNameOrRegExp' |xargs git branch -D
git branch -r| awk -F '[/]' '/regExp/ {printf"%s/%s\n",$2,$3}' |xargs -I{} git push origin :{}
for k in $(git branch -r | sed /\*/d); do
if [ -z "$(git log -1 --since='4 week ago' -s $k)" ]; then
## Info about the branches before deleting
branch_name_with_no_origin=$(echo $k | sed -e "s/origin\///")
echo deleting branch: $branch_name_with_no_origin
## Delete from the remote
git push origin --delete $branch_name_with_no_origin;
## Delete the local branch, regardless of whether it's been merged or not
git branch -D $branch_name_with_no_origin
fi;
done
git remote update origin --prune
touch .gitignore
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"