Git簡要使用

2022-08-31 21:48:16 字數 1143 閱讀 4629

強烈建議先看這篇git - 簡易指南,有助於理解

相信官方文件是最準確的指導,而以下只是適合新手用來快速掌握git

github提供兩種方式的鏈結,https和ssh,其中ssh方式需要rsa密碼,其詳細使用可以參考這篇,如果你只想把**放在本地,這步可以不需要。

在git bash上輸入這些命令,其中序號是注釋,這樣可以看到github上只剩下1 commit

1. checkout

git checkout --orphan latest_branch

2. add all the files

git add -a

3. commit the changes

git commit -am "commit message"

4. delete the branch

git branch -d master

5.rename the current branch to master

git branch -m master

6.finally, force update your repository

git push -f origin master

git add [引數] [--] 《路徑》具體看git add常見用法,對於git add -i,見官方文件

見git commit常見用法,-m其中提到的message,就是相當於對提交的修改起個注釋/關鍵字方便標識,當你git push後會在github上的commit那欄和被修改的檔案看到這個注釋,如圖。

bugfix: 表示修復 bug

feature: 表示增加新功能

add: 表示增加類、檔案、**塊等

delete: 表示刪除類、檔案、**塊等

update: 表示對**塊、功能的更新

refactor: 表示對**塊、功能重構

arch: 表示輸出中間版本,用於測試等

release to v1.0.0: 表示打包輸出的版本號

style:格式(不影響**執行的變動)

git 碼雲 簡要使用

4.3.git push 將本地commit的 更新到遠端版本庫中,例如 git push origin 就會將本地的 更新到名為orgin的遠端版本庫中。git push和git pull正好想反,是將本地某個分支的內容提交到遠端某個分支上。用法 git pushusername ipaddr 遠...

String 方法的簡要使用

記時間 long starttime system.nanotime string str 12 字元轉換成 ascii碼 codepointat character.codepointat str,0 介紹 ascii用於顯示英語字元,是目前世界上最通用的單位元組編碼,基本的ascii編碼包括了1...

svn及其簡要使用方法

建立svn版本庫 svnadmin create home svn project 配置svn資訊 進入版本庫中的配置目錄conf,此目錄有三個檔案 svn服務綜合配置檔案 svnserve.conf 使用者名稱口令檔案 passwd 許可權配置檔案 authz authz設定使用者分組及許可權 p...