Git命令总结

git命令大全 一、基本的linux命令 cd 进入某个目录 pwd 显示当前目录路径 ls(ll) 列出当前目录的文件 ll就是ls -l,列出详细信息 touch 新建一个文件 rm 删除要给文件,加上-rf,就是强制删除目录 mkdir 新建一个目录 mv 移动文件,或者是更改文件名称,mv index.html ./aa,这就是将index.html移动到./aa目录下。mv index.html ./......... 阅读详情


1. Git Basics


git init <directory>:  Create empty Git repo in specified directory .Run with no argument to initialize the current directory as a git repository.


git clone <repo> :  Clone repo located at <repo> onto local machine.Original repo can be located on the local filesystem or on remote machine via HTTP or SSH.


git config user.name <name> : Define author name to be for all commits in current repo.Devs commonly use -- global flag to set config options for current user.


git commit -m "<message>" : Commit the staged snapshot, but instead of launching a text editor, use <message> as the commit message.


git status : List which files are staged, unstaged, and untracked.


git log : Display the entries commit history using the default format. For customization see additional options.


git diff : Show unstaged changes between your index and working directory.



2. Undoing Changes


git revert <commit> : Create new commit that undoes all of the changes made in <commit>, then apply it to the current branch.


git reset <file> : Remove <file> from the staging area, but leave the working directory unchanged. This unstaged a file without overwriting

any changes.


git clean -n : Shows which files would be removed from working directory.Use the -f flag in place of the -n flag to execute the clean.



3. Rewriting Git History


git commit --amend : replace the last commit with the staged changes and last commit combined. use with nothing staged to edit the last

commits message.


git rebase <base> : Rebase the current branch onto <base>.  <base> can be a commit ID, a branch name, a tag, or a relative reference to HEAD.


git reflog : show a log of changes to the local repository's HEAD. Add --relative-date flag to show date info or --all to show all refs.



4. Git Branches


git branch : List all of the branches in your repo. Add a <branch> argument to create a new branch with the name <branch>.


git checkout -b <branch> : Create and check out a new branch named <branch>. Drop the -b flag to checkout an existing branch.


git merge <branch> : Merge <branch> into the current branch.



5. Remote Repositories


git remote add <name> <url> : Create a new connection to a remote repo. After adding a remote, you can use <name> as a shortcut for <url> in other commands.


git fetch <remote> <branch> : Fetches a specific <branch>, from the repo. Leave off <branch> to fetch all remote refs.


git pull <remote> : Fetch the specified remote's copy of current branch and immediately merge it into the local copy.


git push <remote> <branch>: Push the branch to <remote>, along with necessary commits and objects. Creates named branch in the remote

repo if it doesn't exist.



6.  Git config


git config --global user.name <name> : Define the author name to be used for all commits by the current user.


git config --global user.email <email> : Define the author email to be used for all commits by the current user.


git config --global alias.<alias-name> <git-command>: Create shortcut for a Git  command. E.g.alias.glog "log --graph --oneline" will be set "git glog"

equivalent to "git log --graph --oneline"


git config --system core.editor <editor> : set text editor used by commands for all users on the machine. <editor> arg should be the command

that launches the desired editor.


git config --global --edit: Open the global configuration file in a text editor for manual editing.



7. Git log


git log -<limit> : Limit number of commits by <limit>. E.g. "git log -5" will limit to 5 commits.


git log --oneline :  Condense each commit to a single line.


git log --stat :include which files were altered and the relative number of lines that were added or deleted from each of them.


git log -p : Display the full diff of each commit


git log --author="<pattern>": Search for commits by a particular author.


git log --grep="<pattern>" : Search for commits with a commit message  that matches <pattern>.


git log <since> .. <until>: show commits that occur between <since> and <until>.  args can be a commit ID, branch name, HEAD, or any other

kind of revision reference.


git log --<file> : Only display commits that have the specified file.


git log --graph --decorate : --graph flag draws a text based graph of commits on left side of commit msgs. --decorate adds names of branches

or tags of commits shown.



8. Git diff


git diff HEAD : Show difference between working directory and last commit.


git diff --cached : Show difference between staged chnages and last commit.



9. Git reset


git reset : Reset staging area to match most recent commit, but leave the working directory unchanged.


git reset --hard : Reset staging area and working directory to match most recent commit and overwrites all chnages in the working directory alone.


git reset <commit> : Move the current branch tip backward to <commit>, reset the staging area to match, but leave the working directory alone.


git reset --hard <commit> : Same as previous, but resets both the staging area & working directory to match. Deletes uncommitted chnages, and 

all commits after <commit>



10. Git rebase


git rebase -i <base> : Interactively rebase current branch onto <base>. Lanuches editor to enter commands for how each commit will be 

transferred to the new base.



11. Git pull


git pull --rebase <remote> : Fetch the remote's copy of current branch and rebases it into the local copy. Uses git rebase instead of merge to 

integrate the branches.



12. Git push


git push <remote> --force : forces the git push even if it results in a non-fast-forward merge. Do not use the --force flag unless you're absolutely

sure you know what you're doing


git push <remote> --all : Push all of your local branches to the specified remote


git push <remote> --tags : tags aren't automatically pushed when you push a branch or use the --all flag. the --tags flag sends all of your local tags to the remote repo.









华为OD机试双机位C卷-几何平均值最大子数组(Py/Java/C/C++/Js/Go) 华为OD机试(机考)2026双机位C卷 【几何平均值最大子数组】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【几何平均值最大子数组】。 阅读详情

相关推荐

论文超详细精读|万字:2s-AGCN

1. 提出了一种新的双流自适应图卷积网络(2S-AGCN)用于基于骨架的动作识别。**模型中的图的拓扑既可以统一地学习,也可以通过BP算法以端到端的方式单独学习。** 2. 提出了一种同时对**一阶和二阶信息(骨架的长度与方向)建模的双流框架**,在识别精度上有了显著的提高。 它将骨架数据的图结构参数化,并嵌入到网络中,与模型共同学习和更新。 3. 文章主要创新点有两个,一个是双流网络,另外一个是自适应。

IanYue的博客 6382

【工具配置】【git】- 关联本地仓库到远程仓库

在想要创建的git的目录下用以下指令,创建一个本地仓库 git init 登陆自己的github账号,复制想要上传仓库的url的地址,就是我们平常git clone的那个地址 输入以下指令关联本地仓库到远程仓库 $ git remote add [<options>] <name> <url> # 即为 url.git 为你复制的远程仓库地址 $ git remote add origin url.git # 举个栗子 $ git remote add or.

weixin_42279212的博客 964

RoCE Overlay

1. RoCE over vxlan 配置vxlan封装的RoCE流量,可以在PF switchdev模式下利用ovs bridge,或直接设置tc rules。下面将基于一对NIC互联的服务器介绍两种方式的使用,并分析封装后的数据包结构。 1.1. 基本配置 - VF与switchdev 首先创建VF,并为两个host设置PF的switchdev模式。使用ovs bridge或tc rules,...

sunshuying1010的博客 3058

gitee中的坑usage: git remote add [<options>] <name> <url>

如果提示: usage: git remote add []

tumu6889的博客 1376

C++ bitset总结

数据结构bitset 术语:某1位置位是置1,某一位复位是某一位清零。 文章目录数据结构bitset一、3种初始化方式二、位访问三、位操作四、 位集操作总结实战练习 一、3种初始化方式 bitset<32> tmp; //默认构造函数,默认全0。 bitset<32> tmp(-1); //从整形数构造 bitset<32> tmp("101"); //从包含1和0的字符串构造 二、位访问 bitset<32> tmp(256)

qq_43807092的博客 719

滤波器初步入门(非常全面)

主要关注的是-3dB这个点,-3dB就是截止频率所对应的点,我们把功率降至50%以下的信号定义为被衰减掉了(但要跟实际情况相结合,有些信号衰减-3db不够,需要衰减更多)-3dB这个点对应我们的电压来说是0.707。设计电路可以留一定的余量,如果你把4k设计为截止频率,那么4k时候衰减倍数为-3dB通常是不够的,你可以将截止频率设为2k,那么4k的衰减就可以达到15dB(假设),根据自己的需要去设计对应的截止频率。理想的滤波器是当输入的信号频率大于截止频率时,大于部分的频率对应的电压信号直接归0。

yybyybds的博客 5719

git基础

目录 获取Git仓库 现有目录初始化仓库 克隆现有仓库 记录每次更新到仓库 跟踪/暂存文件 检查文件当前状态 忽略文件 查看已暂存和未暂存的修改 提交更新 移除文件 移动文件 查看提交历史 撤销操作 撤销对暂存区操作 撤销对工作目录操作 远程仓库使用 查看远程仓库 添加远程仓库 远程仓库的拉取、抓取和推送 查看仓库 仓库移除和重命名 打标签 列...

weixin_40953784的博客 1480

刷爆 Java 基础!1000 道经典面试题精解第一篇【序列化】

自定义序列化 / 反序列化的实现方式在实现接口的类中,手动重写和方法在方法内优先调用执行默认序列化逻辑;追加自定义逻辑(如敏感数据加密、临时字段赋值、兼容旧版本数据等)。// 序列化ID,保证兼容性// 敏感字段,默认不序列化,自定义处理// 自定义序列化// 执行默认序列化:写入username// 自定义逻辑:密码加密后写入// 自定义反序列化// 执行默认反序列化:读取username// 自定义逻辑:读取加密密码并解密// 模拟加密/解密工具方法。

七叔的博客 191

git 跟踪远程分支

命令的最终修改都是针对.git/config文件 1  @  使用--set-upstream去跟踪远程分支             git  branch --set-upstream my_branch origin/my_branch     origin is your remote repo  , you  can add a remote repo :      git

Open Source Project Share的专栏 1196

SIMATIC WINCC V8.0安装教程(Win11系统)

SIMATIC WINCC V8.0安装教程(Win11系统)

Robot_PLC_HMI_Automation 9024

YOLO26改进策略【Neck】| CVPR 2024 MFM(Modulation Fusion Module,调制融合模块):动态特征加权融合,突出关键特征抑制冗余

本文主要利用DCMPNet中的 MFM 模块优化 YOLO26 的目标检测网络模型。模块通过动态调制特征融合过程,实现了对多尺度、跨层级特征的智能聚合。将其应用于的改进过程中,针对目标检测中边界特征与语义信息的互补性需求,缓解网络中浅层细节与深层语义融合不足的问题。Depth Information Assisted Collaborative Mutual Promotion Network for Single Image Dehazing在图像去雾网络中,不同层级和类型的特征包含着互补的信息(如浅层的

Limiiiing的博客 221

Git 命令使用

Git 常用命令

chinusyan的专栏 2576

Visual Studio Code ADT Extension 能不能连接 ECC,答案是可以,但真正的门槛在 ABAP 后端版本

Visual Studio Code 版 ABAP Development Tools(ADT)支持连接传统 SAP ECC 系统,关键不在于系统名称,而在于底层 SAP NetWeaver AS ABAP 版本是否达到最低要求(7.31 SP04 及以上)。只要系统已支持 Eclipse ADT,即可无缝使用 VS Code ADT,无需升级后端。SAP 通过复用原有 ADT 技术栈,将兼容性逻辑置于客户端,实现对老系统的持续支持。尽管初期侧重 ABAP Cloud 模型,但 1.1 及后续版本已全面覆盖

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 45

Git Push命令

如果我们说在git方面,那么我们可以说,如果远程包含未跟踪的提交,它会使其失败。远程端可以是GitHub、Subversion或任何其他git服务等任何远程位置,分支是一个特定的分支名称。它删除没有本地对应的远程分支。意思是,如果你有一个远程分支,比如demo,如果这个分支在本地不存在,那么它将被删除。现在,当我们在远程端推送它时,它会给出比默认的git push更多的描述。在上面的输出中,推送的文件abc.jpg被上传到我的GitHub账户的主分支仓库中。它可以是URL,也可以是远程存储库的名称。

m0_65696193的博客 1685

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

git命令详解

ps:我在注册git账号的时候遇到一个问题,输入完用户名邮箱密码后,需要验证,也就是Verify account,但是我到这一步的时候一直转圈圈,提示:Unable to verify your captcha response.查了一下有的说是不支持IE浏览器内核,有的说重新刷新DNS,我都试了都不好使,最后还是换到手机的QQ浏览器,注册成功的。选择public,这样大家都可以看到。这个路径中的Administrator是你电脑的用户名,你自己的电脑不是这个用户名的话,改成自己的。

面团酥的博客 1783

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

git命令

一直在用git版本控制,一直没时间总结,今天终于忙中偷闲总结一下git命令: git config --global user.email “邮箱名”:绑定GitHub邮箱 git config --global user.name “Github名”:绑定GitHub git init:初始化一个空的git仓库 git status:检查仓库中的文件状态 git add:添加文件到暂存区 git...

if_7elsetrue的博客 3449

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

git 命令速查

打开cmd窗口,输入命令获取可用的子命令和一些概念指南。输入命令阅读一个特定的子命令解释。,其它版本可在内容区左上角选定版本号。本篇命令版本基于git version。

ZQL20040712的博客 775

windows 怎么使用git 命令

在上执行。

dlz0836的博客 3208

Git Commit命令

我们可能需要一些与提交相关的其他基本操作,如还原提交、撤销提交等,但这些操作并不属于提交命令的一部分。如果不小心提交了错误的提交消息,那么这个功能对我们来说是一个野蛮的选择。暂存允许我们继续对存储库进行更改,而当我们想要将这些更改共享到版本控制系统时,提交允许我们记录这些更改。当我们运行该命令时,它将提示一个默认的文本编辑器,并要求输入提交消息。我们可以从上面的输出中看到,日志选项显示了提交ID、作者详细信息、日期和时间,以及提交消息。这个命令将立即为已经暂存的文件进行提交,并附带一个提交消息。

m0_65696193的博客 1883

Linux命令+Git命令

Linux操作系统中,几乎所有的东西都以文件夹或文件形式存在,这些文件夹/文件有一个。cd 命令在 Linux 和 Windows 中都可以接受绝对路径和相对路径,都是。是用来切换盘符的,因为 Windows 文件系统基于不同的盘符来管理不同的磁盘,或类似的选项,只需要指定路径,不需要考虑盘符的问题,因为 Linux 是一个。它的文件系统是统一的,所有的磁盘和分区都挂载到一个根目录。选项)的区别外,Linux 和 Windows 中的。是Linux的文本编辑器,有很多命令和模式。的操作依赖于 不同的模式,

少年何妨梦摘星,敢挽桑弓射玉衡。 他时若遂凌云志,敢笑黄巢不丈夫。 1917

Git Diff命令

从上面的输出中,我们可以看到git diff命令显示了在newfile1.txt上所做的更改。Git允许我们跟踪两个提交之间的修改,无论是最新的提交还是旧的提交。git diff命令允许我们跟踪已经分阶段但尚未提交的更改。假设我们已经为仓库提交了一个文件,并在提交后进行了一些额外的更改。我们可以使用git status命令跟踪分支的更改,但还有其他一些命令可以详细解释。在下面的输出中,我们已经提交了我们对newfile1.txt所做的更改。git diff命令的常规用法是跟踪尚未暂存的变更。

m0_65696193的博客 1227

php git命令,git命令实践,git命令

git命令实践,git命令一、命令git checkout -b 分支名 //创建分支并切换到该分支git checkout 分支名 //切换到该分支git merge 分支名 //把分支合并到当前分支git branch -d 分支名 //删除该分支git branch -D 分支名 //强制删除该分支git log|head //最近一次记录git log --pretty=oneline /...

weixin_36098237的博客 566

Git Init命令

git init命令在当前工作目录中创建一个.git子目录。对于学习Git来说,了解如何在Git上创建一个项目是很重要的。因此,我们可以使用git init命令创建一个仓库。上述命令将创建一个空的.git仓库。我的现有项目中加入了一个空的存储库.git。的新的子目录,该目录包含了所有必需的存储库文件。它可以将一个现有的项目变成一个Git项目。仓库内部会运行多个Git命令,但是init命令可以在仓库之外运行。git init命令允许我们同时创建一个新的空仓库和一个目录。的目录下创建一个空的.git仓库。

m0_65696193的博客 928

【git】Git - add命令

Git命令介绍: 工作目录下面的所有文件都不外乎这两种状态:已跟踪或未跟踪。 git add命令 这是个多功能命令 ,根据目标文件的状态不同,此命令的效果也不同: (1)可以用它开始跟踪新文件 (2)把已跟踪的文件放到暂存区 (3)还能用于合并时把有冲突的文件标记为已解决状态等)。 GIT命令使用: git add 文件名字/文件夹名字 怎...

左耳的专栏 1万+

git 命令查询

git 命令查询

云博客_资源宝分享 1709

git命令简写

git简写命令,便于开发,提升效率

eos-i的博客 3703
上一篇: 推送仓库到github
下一篇: GDB查看变量
tkp2014
博客等级 码龄12年 137粉丝 241原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值