Git Bash

作者: 小马哒哒哒哒哒哒 | 来源:发表于2018-01-16 10:37 被阅读0次

    项目初始化流程

    1.登陆 github

    2.创建仓库

    3.把本地项目 “右键” 打开 Git Bash

    4.git init (把本地项目添加到 “暂存区”)

    5.git add . (把本地项目添加到 “暂存区”)

        5.1 报错:warning: LF will be replaced by CRLF in app.js.

                            The file will have its original line endings in your working directory.

    原因:路径中存在 / 的符号转义问题,false就是不转换符号默认是true,相当于把路径的 / 符号进行转义,这 样添 加的时候就有问题

    解决:git config --global core.autocrlf false

    6.git status (查看状态)

    7.git commit -m "填写提交理由"

    8.git remote add origin 云端SSH (链接到云端)

    9.git push -u origin master(推送到云端)


    常用命令

    git checkout -b 分支名 : 创建并切换分支

    git branch 分支名 : 创建分支

    git checkout 分支名 : 切换分支

    git branch -a : 查看所有分支

    git branch -d 分支名 : 删除分支

    git status : 查看状态

    git diff : 查看是否有改动

    git add . :添加到暂存区

    git commit -m "填写提交理由"

    git merge 合并

    git push  origin (分支名) 推送到远程

    其他命令

    git pull origin 远程分支名 : 拉去某个分支的最新代码

    git checkout 主分支    →    git pull    →    git checkout 自己分支    : 拉取本地分支

    git branch -vv  :查看本地分支和远程分支的关联

    git checkout -b feature-branch origin/分支名   :远程分支检出到本地

    git push origin 本地分支名/远程分支名 :将本地分支推送到远程

    git branch --set-upstream-to=origin/远程分支名  本地分支的名  :远程分支 与 本地分支关联


    互动型 Git 学习网站 : https://learngitbranching.js.org/

    相关文章

      网友评论

          本文标题:Git Bash

          本文链接:https://www.haomeiwen.com/subject/xyzjoxtx.html