日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Git各区的添加与撤销[实际操作验证]

發(fā)布時間:2024/9/19 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Git各区的添加与撤销[实际操作验证] 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

語法

Git分三個區(qū)

? ? ? ? ? ? ? ? ? ? 工作區(qū)----(add)--->暫存區(qū)----(commit)--->本地版本庫----(push)---->遠程版本庫

工作區(qū)的取消

git restore 文件名字

暫存區(qū)git add .? 后的取消??

git restore --staged ?PHPInterview/2.strpos.php

本地版本庫git commit? 后的取消??

$ git log -2 選擇倒數(shù)第二個 $ git reset --soft ec9bf0be9942e9f17e0431bd88c2737622353154

遠程版本庫git push后的? ?

$ git log -2 選擇倒數(shù)第二個 $ git reset --hard ec9bf0be9942e9f17e0431bd88c2737622353154 此處不可git pull $ git push --force

工作區(qū)例子

Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git status On branch master Your branch is up to date with 'origin/master'.Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)modified: PHPInterview/2.strpos.phpno changes added to commit (use "git add" and/or "git commit -a")Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git restore PHPInterview/2.strpos.phpAdministrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git status On branch master Your branch is up to date with 'origin/master'.nothing to commit, working tree cleanAdministrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master)

?暫存區(qū)例子

Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git status On branch master Your branch is up to date with 'origin/master'.Changes to be committed:(use "git restore --staged <file>..." to unstage)modified: PHPInterview/2.strpos.phpAdministrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git restore --staged PHPInterview/2.strpos.phpAdministrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git status On branch master Your branch is up to date with 'origin/master'.Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)modified: PHPInterview/2.strpos.phpno changes added to commit (use "git add" and/or "git commit -a")

本地版本庫例子

Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git status On branch master Your branch is ahead of 'origin/master' by 1 commit.(use "git push" to publish your local commits)nothing to commit, working tree cleanAdministrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git log -2 commit 45ce87d9ce1505a11a7f67a61e0c4acfa950a972 (HEAD -> master) Author: 7117 <qinglangsalaheiyou@163.com> Date: Fri Nov 13 11:16:40 2020 +0800echocommit ec9bf0be9942e9f17e0431bd88c2737622353154 (origin/master) Author: 7117 <qinglangsalaheiyou@163.com> Date: Tue Oct 27 13:07:57 2020 +08001Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git reset --soft ec9bf0be9942e9f17e0431bd88c2737622353154Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git status On branch master Your branch is up to date with 'origin/master'.Changes to be committed:(use "git restore --staged <file>..." to unstage)modified: PHPInterview/2.strpos.php

遠程版本庫回退例子

$ git log -2 commit 30f126a4a49c6036444e6fee7fdc6d0fe45f58f7 (HEAD -> master, origin/master) Author: 7117 <qinglangsalaheiyou@163.com> Date: Fri Nov 13 11:18:51 2020 +0800echo 2commit ec9bf0be9942e9f17e0431bd88c2737622353154 Author: 7117 <qinglangsalaheiyou@163.com> Date: Tue Oct 27 13:07:57 2020 +08001Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git reset --hard ec9bf0be9942e9f17e0431bd88c2737622353154 HEAD is now at ec9bf0b 1Administrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git status On branch master Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.(use "git pull" to update your local branch)nothing to commit, working tree cleanAdministrator@Jim MINGW64 /d/phpstudy/PHPTutorial/WWW/PHPCollection (master) $ git push --force fatal: HttpRequestException encountered.????????????? Total 0 (delta 0), reused 0 (delta 0) remote: This repository moved. Please use the new location: remote: https://github.com/7117/phpCollection.git remote: remote: GitHub found 4 vulnerabilities on 7117/phpCollection's default branch (2 high, 2 low). To find out more, visit: remote: https://github.com/7117/phpCollection/network/alerts remote: To https://github.com/7117/CodePractice+ 30f126a...ec9bf0b master -> master (forced update)

?

總結(jié)

以上是生活随笔為你收集整理的Git各区的添加与撤销[实际操作验证]的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。