zoukankan      html  css  js  c++  java
  • 25个每个人都应该知道的Git命令

    1、初始化本地Git存储库

    git init

    2、创建远程存储库的本地副本

    git clone ssh://git@github.com/[username]/[repository-name].git

    3、检查状态

    git status

    4、将文件添加到暂存区

    git add [file-name.txt]

    5、将所有新文件和更改过的文件添加到登台区域

    git add -A

    6、提交更改

    git commit -m "[commit message]"

    7、删除文件(或文件夹)

    git rm -r [file-name.txt]

    8、列出分支(星号表示当前分支)

    git branch

    9、创建一个新分支

    git branch [branch name]

    10、删除分支

    git branch -d [branch name]

    11、创建一个新分支并切换到该分支

    git checkout -b [branch name]

    12、克隆一个远程分支并切换到该分支

    git checkout -b [branch name] origin/[branch name]

    13、重命名本地分支

    git branch -m [old branch name] [new branch name]

    14、切换到分支

    git checkout [branch name]

    15、将一个分支合并到活动分支中

    git merge [branch name]

    16、将一个分支合并到一个目标分支

    git merge [source branch] [target branch]

    17、将更改存储在不合适的工作目录中

    git stash

    18、删除所有隐藏的条目

    git stash clear

    19、将分支推送到你的远程存储库

    git push origin [branch name]

    20、将更改推送到远程存储库

    git push

    21、将本地存储库更新为最新的提交

    git pull

    22、从远程存储库中提取更改

    git pull origin [branch name]

    23、添加一个远程存储库

    git remote add origin ssh://git@github.com/[username]/[repository-name].git

    24、查看更改

    git log

    25、合并前预览更改

    git diff [source branch] [target branch]

    参考---https://mp.weixin.qq.com/s/0rWTt5xZXE1ObosVDqcLvg

  • 相关阅读:
    Flutter高仿微信项目开源-具即时通讯IM功能
    flutter 如何实现文件读写(使用篇)
    这是我的第一篇博客,测试文章
    对于ServiceManager的理解
    Class文件结构
    App进程的启动
    对于SystemServer的理解
    对于Zygote的理解
    Git内部原理浅析
    二叉搜索树(BST)基本操作
  • 原文地址:https://www.cnblogs.com/pwindy/p/15005381.html
Copyright © 2011-2022 走看看