1. git clone -b develop_name xxxxxxxx.git // 克隆某一分支到本地
2. git pull original remote_branch : local_branch // 从远程分支拉取到本地分支
3. git push original local_branch : remote_branch // 将本地分支推送至远程分支
4. git init // 初始化一个本地库,即就是将该工程用 git 管理起来
5. git status // 查看当前 代码区,暂存区,本地库的状态
6. git add . // 将所有变更文件添加到暂存区 (也可以使用 -u 参数)
7. git commit -m "comment_message" // 将暂存区提交到本地库并添加提交信息
8. git branch -av // 查看所有本地及远程分支,带 * 的为当前分支
9. git remote -v // 查看所有的远程库别名及地址信息
10. git log --pretty=oneline / git log --oneline -n // 以行为单位显示前 n 个日志记录
11. git reflog // 查看每个 commit 的 index 方便回退版本使用,可以配合 --oneline -n 参数使用
12. git reset --hard index_value / git reset --hard HEAD^ / git reset --hard HEAD~n // 回退版本库的几种方法,推荐使用第一种
13. git checkout branch_name // 切换到 branch_name 分支
14. git merge other_branch // 将 other_branch 合并到当前分支(前提是已经处于当前分支)
15. git remote add alias_name https://github.com/xxxxx/xxxxx.git // 给远程库添加别名 alias_name
16. git branch -d branch_name // 删除本地分支 branch_name;
17. git branch -m old_branch new_branch // 将 old_branch 分支重命名为 new_branch
18. git push remote_alias_name --delete remote_branch_name // 删除远程分支remote_branch_name
19. git 修改远程仓库url
git remote set-url remote_name new_remote_url
eg: git remote set-url origin_ssh git@github.com:USERNAME/OTHERREPOSITORY.git (为ssh登录方式创建一个远程仓库别名)