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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

Git GitHub Gitee GitLab

發(fā)布時間:2023/12/3 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Git GitHub Gitee GitLab 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

Git

Git 常用命令

git --version 查看 git 版本
git config --global user.name 用戶名 設(shè)置用戶簽名
git config --global user.email 郵箱 設(shè)置用戶簽名

git init 初始化本地庫

dell@DESKTOP-VSDN0Q2 MINGW64 /d/Git-Space/SH0720
$ git init
Initialized empty Git repository in D:/Git-Space/SH0720/.git/
dell@DESKTOP-VSDN0Q2 MINGW64 /d/Git-Space/SH0720 (master)
$ ll -a
total 4
drwxr-xr-x 1 dell 197121 0 May 3 12:27 ./
drwxr-xr-x 1 dell 197121 0 May 3 12:27 …/
drwxr-xr-x 1 dell 197121 0 May 3 12:27 .git/

vim hello.txt 新建文件

  • i 編輯
  • esc
  • yy 復(fù)制
  • p 粘貼
  • :wq 保存
  • ll 當(dāng)前目錄下查看
  • cat 查看文件內(nèi)容
  • tail -n 1查看文件末尾第一行內(nèi)容
  • git status 查看本地庫狀態(tài)
    git add 文件名 添加到暫存區(qū)
    git commit -m “日志信息” 文件名 提交到本地庫
    git reflog 查看歷史記錄
    git reset --hard 版本號 版本穿梭

    Git 分支

    git branch 分支名 創(chuàng)建分支
    git branch -v 查看分支
    git checkout 分支名 切換分支
    git merge 分支名 把指定的分支合并到當(dāng)前分支上

    沖突合并

    沖突產(chǎn)生的表現(xiàn):后面狀態(tài)為 MERGING

    dell@DESKTOP-VSDN0Q2 MINGW64 /d/Git-Space/SH0720(master|MERGING)

    沖突產(chǎn)生的原因:
    合并分支時,兩個分支在同一個文件的同一個位置有兩套完全不同的修改。Git 無法替
    我們決定使用哪一個。必須人為決定新代碼內(nèi)容。

    解決: 手動解決

    步驟:
    1)編輯有沖突的文件,刪除特殊符號,決定要使用的內(nèi)容
    特殊符號:<<<<<<< HEAD 當(dāng)前分支的代碼 ======= 合并過來的代碼 >>>>>>> hot-fix

    hello git! hello atguigu! 2222222222222 hello git! hello atguigu! 3333333333333 hello git! hello atguigu!hello git! hello atguigu! hello git! hello atguigu! hello git! hello atguigu! hello git! hello atguigu! hello git! hello atguigu! hello git! hello atguigu! hello git! hello atguigu! hello git! hello atguigu! hello git! hello atguigu! hello git! hello atguigu! hello git! hello atguigu! hello git! hello atguigu! master test hello git! hello atguigu! hot-fix test

    2)添加到暫存區(qū)

    Layne@LAPTOP-Layne MINGW64 /d/Git-Space/SH0720 (master|MERGING) $ git add hello.txt

    3)執(zhí)行提交(注意:此時使用 git commit 命令時不能帶文件名)

    Layne@LAPTOP-Layne MINGW64 /d/Git-Space/SH0720 (master|MERGING) $ git commit -m "merge hot-fix" [master 69ff88d] merge hot-fix

    –發(fā)現(xiàn)后面 MERGING 消失,變?yōu)檎?/p> Layne@LAPTOP-Layne MINGW64 /d/Git-Space/SH0720 (master) $

    GitHub

    遠(yuǎn)程倉庫操作

    git remote -v 查看當(dāng)前所有遠(yuǎn)程地址別名
    git remote add 別名 遠(yuǎn)程地址 起別名
    git push 別名 分支 推送本地分支上的內(nèi)容到遠(yuǎn)程倉庫
    git clone 遠(yuǎn)程地址 將遠(yuǎn)程倉庫的內(nèi)容克隆到本地
    git pull 遠(yuǎn)程庫地址別名 遠(yuǎn)程分支名 將遠(yuǎn)程倉庫對于分支最新內(nèi)容拉下來后與當(dāng)前本地分支直接合并(拉取

    總結(jié)

    以上是生活随笔為你收集整理的Git GitHub Gitee GitLab的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

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