赞
踩
# 初始化仓库 git init # 设置全局用户名和邮箱 git config --global user.name "[name]" git config --global user.email "[email address]" # 将文件添加到暂存区 git add <file> # 将所有修改过的文件添加到暂存区 git add . # 提交暂存区的更改 git commit -m "commit message" # 查看提交历史 git log # 查看一行的提交历史 git log --oneline # 查看工作目录和暂存区的差异 git diff # 查看暂存区和上一次提交的差异 git diff --cached # 撤销对文件的更改 git reset HEAD <file> # 重置当前分支到指定状态 git reset --hard # 列出所有本地分支 git branch # 列出所有远程分支 git branch -r # 创建并切换到新分支 git checkout -b <branch> # 切换到指定分支 git checkout <branch> # 将指定分支的更改合并到当前分支 git merge <branch> # 从远程仓库拉取最新更改并自动合并到当前分支 git pull # 将本地分支的更改推送到远程仓库 git push # 推送指定分支到远程仓库 git push origin <branch> # 查看远程仓库的详细信息 git remote -v # 添加远程仓库 git remote add origin <repository> # 使用工具解决合并冲突 git mergetool # 应用补丁文件 git apply <patch-file> # 查看补丁应用的摘要 git apply --summary <patch-file> # 撤销补丁 git apply --reverse <patch-file> # 从工作目录和暂存区删除文件 git rm <file> # 删除已合并的本地分支 git branch -d <branch> # 列出所有标签 git tag # 创建新标签 git tag <tagname> # 推送标签到远程仓库 git push --tags
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。