有用的git建議

2022-07-03 17:09:11 字數 1371 閱讀 6072

這篇文章的目的是給經常使用git管理專案提供乙個有益的提醒。如果你是git新手,可以先閱讀文後的引用部分,然後在回頭閱讀此篇文章。在介紹git命令之前,你可以先看看來自 on-my-zsh 提供的別名。

git init:初始化乙個repo。

git help:檢視對應命令的幫助手冊

git log(glg,glgg,glo,glog):檢視專案的提交歷史

git diff(gd):檢視基於當前檔案的最後一次提交的更改差異

git diff(gd):檢視基於所有檔案的最後一次提交的更改差異

git reset head~2 --soft:從專案提交歷史中刪除最近兩次提交,但不丟棄檔案的更改

git reset head~2 --hard:從專案提交歷史中刪除最近兩次提交,但會丟棄檔案的更改和在(最後兩次)提交中建立的新檔案

git reset --soft --hard

git reflog:顯示包括 被撤銷 在內的所有提交

git merge:重新提交(restore the commit)

git clean -f:刪除工作目錄中不被git進行版本追蹤的檔案

stash

branch

# go to the `master` branch

git checkout master

# create a temp branch

git checkout -b temp

# merge the feature/x branch into the temp using --squash

git merge feature/x --squash

# see the new modifications/files in the staging area

git status

# create the unified commit

git commit -m "add feature/x"

# delete the feature/x branch

git branch -d feature/x

merge:

Linux學習 有用的建議

新手建議 遠端操控系統時候 不要關機 遠端操控時候 重啟前要將開啟的檔案關閉 配置防火牆的時候不要把自己給牆了 不要隨意的改動ip 密碼注意符合規則 並且定期更換 注意備份重要資料和日誌,雞蛋不要都放在乙個籃子裡,多備份到幾個地方 網盤,硬碟,本機 多位置 linux中是沒有副檔名的,有的檔案看起來...

git 有用的指令

檢查當前branch git branch 本地倉庫建立新的branch git branch new branch name 本地倉庫換到其他branch上工作 git checkout branch name 本地倉庫加入新的檔案 git add 本地倉庫commit全部修改 git commi...

PHP 10條有用的建議

1.使用ip2long 和long2ip 函式來把ip位址轉化成整型儲存到資料庫裡。這種方法把儲存空間降到了接近四分之一 char 15 的15個位元組對整形的4個位元組 計算乙個特定的位址是不是在乙個區段內頁更簡單了,而且加快了搜尋和排序的速度 雖然有時僅僅是快了一點 2.在驗證email位址的時...