git (自用)

2021/4/9 18:55:07

本文主要是介绍git (自用),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

自己

 

<!-- (一) -->
    git clone "url"     将代码克隆岛本地


<!-- (二)常用的四步命令(建议这个顺序,(先 commit 后 pull)) -->
    1. git add .       添加到暂存

    2. git commit -m "miaoshu"     提交暂存区的文件到本地仓库(添加文件描述信息)
        
    3. git pull        拉取

    4. git push        推送


<!-- (三) git 首次推送到远程流程 -->
    1. git init //初始化仓库

    2. git add .(文件name)      添加文件到本地仓库

    3. git commit -m "first commit"     提交暂存区的文件到本地仓库(添加文件描述信息)

    4. git remote add origin + 远程仓库地址         链接远程仓库,创建主分支

    5. git pull origin master --allow-unrelated-histories       把本地仓库的变化连接到远程仓库主分支 (:q) 退出 

    6. git push -u origin master        把本地仓库的文件推送到远程仓库
        不是首次推送的话,git push origin master



<!-- (四)Git强制覆盖本地代码,保持与远程仓库一致 -->
    1. git fetch --all

    2. git reset --hard origin/master

    3. git pull

  



这篇关于git (自用)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程