# git **Repository Path**: huhonghaohhh/git ## Basic Information - **Project Name**: git - **Description**: git常用命令 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-12-11 - **Last Updated**: 2022-12-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## git常用命令 ### 修改提交回退 git init 新建版本库 git status 查看状态 git add xxx 添加新增、修改过的文件到暂存区 git commit -m "xxx" 提交并添加备注 git log 查看提交日志 git reset --hard HEAD^ 回退到上一个版本 git reset --hard xxx 回退到指定版本, 可通过git log和git reflog查看历史版本 ### 分支 git branch xxx 创建分支 git branch 查看分支 git checkout xxx 切换 git merge xxx 合并xxx到当前分支 git branch -d xxx 删除分支 ### gitee git clone xxx 拉取 git remote add origin xxx 关联远程仓库 其中,xxx形如git@gitee.com:huhonghaohhh/i2c_code.git git remote rm origin 解除关联 关联后,可使用简单命令进行同步 git pull origin master 拉取远程仓库(指定master分支) git push origin master 推送到远程仓库(指定master分支) git push -u origin master 推送到远程仓库(指定master分支) 使用-u后就可以直接使用git push