Git Product home page Git Product logo

git-docs's Introduction

# 不更改文件强制commit
git commit --allow-empty -m "push for deploy"

# 查看历史commit
git log  # 按q退出


# 清空commit
git reset [--soft] HEAD^
# 带着新文件回到上一个版本
# HEAD~n: 上n个版本

git checkout --orphan branch_name
# 创建一个全新的分支 (没有任何文件,也没有历史commit)

git branch -D main
# 强制删除main分支

git branch -M main
# 把当前分支改名为main并作为主分支


# 修改历史版本,保留新版本
cp ../myrepo ../myrepo.old -r
cd ../myrepo.old

git log

git reset --hard commit_id
# 回到出错后的版本

git reset HEAD^
# 带着你的错误代码回到出错前
# 修改你的代码

git commit -m "xxx"
# 提交修好的代码

git push -f
# 强制更新一波

cp ../myrepo
# 回到没啥问题的新版本

git fetch -a
# 拉取刚刚推送的代码

git rebase
# 篡改历史
# 处理一下冲突,建议用图形化工具比如vscode

git commit -m "最新版又回来了"

git-docs's People

Contributors

mzbgf avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.