git 版本管理工具说明
2024-08-22 20:24:42
- $ git init (初始化本地仓库,会生成.git 文件夹 .git 文件夹里存储了所有的版本信息、标记等内容)
- $ git add . (从本地仓库增删,结果将会保存到本机的缓存里面)
- $ git commit -m " 第 次提交 " (提交,把本机缓存中的内容提交到本机的 HEAD 里面)
- $ git remote add origin http:\\....... (把本地仓库和远程仓库关联起来。如果不执行这个命令的话,每次 push 的时候都需要指定远程服务器的地址)
- $ git push origin master (把本地
master
分支的最新修改推送至远端 (如GitHub)) - $ git pull origin master (将远端仓库pull最新代码)
Username for 'https://github.com': yjlgithup
To https://github.com/yjlgithup/bu.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/yjlgithup/bu.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.如果出错:git pull --rebase origin master
提交代码到远程分支
1.git checkout -b ' two ' (切换并创建一个分支)
2.git add . (提交分支代码)
3.git commit -m '' (提交 修改信息)
4.git remote add origin http://.... (连接远程仓库)
5.git pull origin master (重新拉一边代码)
6.git push origin two (提交分支代码)
githup 上面会出现你心创建的分支,并且提交的代码
拉取分支代码到本地
当我想从远程拉取到一条本地不存在的分支 代码
1.git init (初始化)
2.git remote add origin http://.... (连接远程仓库)
3.git clone (首次拉取代码)
4.git pull origin master
5.git fetch
6.git checkout -b (本地分支名称 two )origin/(远程分支名称 two)
推荐学习资料:
廖雪峰的官方教程Git http://www.liaoxuefeng.com/wiki/Git
最新文章
- js-倒计时自动隐藏
- 此操作失败的原因是对 IID 为“{000208DA-0000-0000-C000-000000000046}”的接口的 COM 组件调用 QueryInterface
- STM8L --- External interrupt
- Tomcat热部署和虚拟目录配置
- 【Leetcode】 LRU Cache实现
- php循环创建目录
- GDI 对象的释放与内存泄漏的问题研究
- (简单) POJ 2240 Arbitrage,SPFA。
- [WC2006]水管局长数据加强版
- Pandas系列(三)-缺失值处理
- 白话skynet第三篇:通过队列解决多线程竞争资源
- Bi-shoe and Phi-shoe
- day2 大纲笔记
- Java第三阶段学习(八:网络通信协议、UDP与TCP协议)
- 如何让我domain里的机器都跟domain controller的时间保持一致?
- L1-025 正整数A+B
- OpenDiscussion_DataDrivenDesign
- Maven实战(八)pom.xml简介
- 转:Exploiting Windows 10 in a Local Network with WPAD/PAC and JScript
- d3.js(v5.7)的node与数据匹配(自动匹配扩展函数)
热门文章
- Goldengate进程的合并与拆分规范
- 如何使 nginx 支撑更高并发
- 使用 swoole_process 实现 PHP 进程池
- Unity 如何将apk放到Android系统的system里
- bootstrap结合google code prettify的问题
- 已知二叉树的中序序列为DBGEAFC,后序序列为DGEBFCA,给出相应的二叉树
- hdoj--1342--Lotto(dfs)
- zzulioj--1801--xue姐的小动物(水题)
- HBase的单节点集群详细启动步骤(分为Zookeeper自带还是外装)
- Java:JDBC操作