欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Git代碼如何提交

這篇文章主要講解了“Git代碼如何提交”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“Git代碼如何提交”吧!

創(chuàng)新互聯(lián)公司主營汶上網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,成都app軟件開發(fā)公司,汶上h5小程序開發(fā)搭建,汶上網(wǎng)站營銷推廣歡迎汶上等地區(qū)企業(yè)咨詢

1.首先需要下載git

查看電腦是否安裝git,打開終端,輸入git,回車如果輸出如下,則代表已安裝了git

Git代碼如何提交

如果未安裝,則會輸出:

Git代碼如何提交

按照提示輸入:sudo apt-get install git即可安裝!!或者到此處下載:git下載,pkg包下載完成,雙擊安裝。

輸入命令:git --version 可查看當(dāng)前git版本

Git代碼如何提交

2.安裝后需要一些配置

配置用戶名和郵箱:

$ git config --global user.name "Your Name"$ git config --global user.email "email@example.com"

使用 --global 修飾后設(shè)置的全局的用戶,如果設(shè)置單個(gè)項(xiàng)目的用戶,可cd到項(xiàng)目根目錄下,執(zhí)行如下命令:

$ git config user.name "Your Name"$ git config user.email "email@example.com"

使用命令:git config --list 可查看當(dāng)前用戶信息以及其他的一些信息

$ git config --list 
core.excludesfile=/Users/mac/.gitignore_global 
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"difftool.sourcetree.path= 
mergetool.sourcetree.cmd=/Applications/SourceTree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"mergetool.sourcetree.trustexitcode=truehttp.postbuffer=524288000 
https.postbuffer=524288000 
user.email=你的郵箱@qq.com 
user.name=你的用戶名 
macdeMacBook-Pro:~ Artron_LQQ$

3.建立本地git倉庫

(1)cd到你的項(xiàng)目目錄

$ cd /Users/cjk/Desktop/myShop

(2)然后,輸入git命令:

$ git init

輸出如下:

$ git init Initialized empty Git repository in /Users/cjk/Desktop/GitTest/.git/

創(chuàng)建了一個(gè)空的本地倉庫.

(3)將項(xiàng)目的所有文件添加到緩存中:

$ git add .

git add . (注意,后面有個(gè)點(diǎn))表示添加目錄下所有文件到緩存庫,如果只添加某個(gè)文件,只需把 . 換成你要添加的文件名即可;

(4)將緩存中的文件Commit到git庫

git commit -m "添加你的注釋,一般是一些更改信息"

下面是第一次提交時(shí)的輸出:

$ git commit -m "添加項(xiàng)目"[master (root-commit) 3102a38] 添加項(xiàng)目 18 files changed, 1085 insertions(+) create mode 100644 GitTest.xcodeproj/project.pbxproj create mode 100644 GitTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 GitTest.xcodeproj/project.xcworkspace/xcuserdata/Artron_LQQ.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 GitTest.xcodeproj/xcuserdata/Artron_LQQ.xcuserdatad/xcschemes/GitTest.xcscheme create mode 100644 GitTest.xcodeproj/xcuserdata/Artron_LQQ.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 GitTest/AppDelegate.h create mode 100644 GitTest/AppDelegate.m create mode 100644 GitTest/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 GitTest/Base.lproj/LaunchScreen.storyboard create mode 100644 GitTest/Base.lproj/Main.storyboard create mode 100644 GitTest/Info.plist create mode 100644 GitTest/ViewController.h create mode 100644 GitTest/ViewController.m create mode 100644 GitTest/main.m create mode 100644 GitTestTests/GitTestTests.m create mode 100644 GitTestTests/Info.plist create mode 100644 GitTestUITests/GitTestUITests.m create mode 100644 GitTestUITests/Info.plist

或者不添加注釋 git commit ,但是這樣會進(jìn)入vim(vi)編輯器

# Please enter the commit message for your changes. Lines starting# with '#' will be ignored, and an empty message aborts the commit.# On branch master# Changes to be committed:#    modified:  LQQCircleShowImage.xcodeproj/project.pbxproj#    modified:  LQQCircleShowImage/TableViewCell.m                                "~/Desktop/LQQCircleShowImage/.git/COMMIT_EDITMSG" 8L, 292C

在這里可以輸入更改信息,也可以不輸入,然后 按住 shift + : ,輸入wq 即可保存信息并退出vim編輯器;

4.建立遠(yuǎn)程庫

在一些代碼托管平臺創(chuàng)建項(xiàng)目,例如github或者開源中國社區(qū),這里已開源中國社區(qū)為例;

創(chuàng)建項(xiàng)目后,會生成一個(gè)HTTPS鏈接,如下:

Git代碼如何提交

5.將本地的庫鏈接到遠(yuǎn)

終端中輸入: git remote add originHTTPS鏈接

$ git remote add origin https://git.oschina.net/liuqiqiang/gitTest.git

6.上傳代碼到遠(yuǎn)程庫,上傳之前最好先Pull一下,再執(zhí)行命令: git pull origin master

輸出:

$ git pull origin master
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From https://git.oschina.net/liuqiqiang/gitTest
 * branch      master   -> FETCH_HEAD
 * [new branch]   master   -> origin/master
Merge made by the 'recursive' strategy.
 README.md | 1 + 1 file changed, 1 insertion(+)
 create mode 100644 README.md

即pull成功,

7.接著執(zhí)行:git push origin master

完成后輸出:

$ git push origin master
Counting objects: 34, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (29/29), done.
Writing objects: 100% (34/34), 15.63 KiB | 0 bytes/s, done.
Total 34 (delta 3), reused 0 (delta 0)
To https://git.oschina.net/liuqiqiang/gitTest.git
  5e2dda1..537ecfe master -> master

感謝各位的閱讀,以上就是“Git代碼如何提交”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對Git代碼如何提交這一問題有了更深刻的體會,具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點(diǎn)的文章,歡迎關(guān)注!

分享題目:Git代碼如何提交
網(wǎng)頁地址:http://chinadenli.net/article30/gjcopo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃自適應(yīng)網(wǎng)站、關(guān)鍵詞優(yōu)化網(wǎng)站導(dǎo)航、網(wǎng)站內(nèi)鏈電子商務(wù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營