一些git命令

Info

git remote -v

git branch -a

 

Push changes

git diff

git status 

git add .

git status

git commit -m "..."

 

git pull origin YOUR_BRANCH

git push origin YOUR_BRANCH

 

Create branch

git branch YOUR_BRANCH

git branch

git checkout YOUR_BRANCH

git branch

 

.ignore

touch .gitignore

 

In our project:

# Ignore bundler config.
/.bundle
/spec/coverage
.DS_Store
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
/config/database.yml
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
/coverage
# Ignore Byebug command history file.
.byebug_history
/public/system/*

 

Merge a branch

git branch -a

git checkout master

git pull origin master        # already up-to-date

 

git branch --merged          # the branches that we have merged

git merge YOUR_BRANCH

git push origin master

 

Deleting a branch

git branch --merged     # double check

git branch -d YOUR_BRANCH

git branch -a

git push origin --delete YOUR_BRANCH

git branch -a

#

git add index.html

git rm -cached index.html

 

Pull

git init

git remote add origin https://.....

git pull origin develop

 

Faster Example

git branch subtract

git checkout subtract

git status

git add .

git commit -m "add subtract"

git push -u origin subtract

git checkout master

git pull origin master

git merge subtract

git commit -m "messages"

git push origin master

posted @ 2018-07-28 18:14  柠檬雨  阅读(274)  评论(0编辑  收藏  举报