Git memo

Git

1. Installation

git config --global user.name "yourname"
git config --global user.email "youremail"
ssh-keygen -t rsa -C "youremail"

2. Local repository

git init

3. Submit

git add filename
git commit -m "description"

4. Operations

git status
git rm filename
git push origin master
git pull
git branch branchname
git checkout branchname # you can do last two lines using checkout -b
git merge branchname # use --allow-unrelated-histories when merge an orphan
git branch -a # use -a to show remote branches
git branch -D branchname # local delete
git branch -r -d origin/branchname # delete index of remote branch locally
git push origin :branchname # delete remote branch
git diff filename

5. Remote repository

git remote add origin [email protected]:accountname/reponame.git
git push -u origin master # use -u for your first push
git clone [email protected]:accountname/reponame.git

猜你喜欢

转载自www.cnblogs.com/humz/p/9146024.html