一些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

    原文作者:柠檬雨
    原文地址: https://www.cnblogs.com/adelaide/p/9382909.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞