git 基础版
来源:互联网 发布:魔兽世界世界观 知乎 编辑:程序博客网 时间:2024/05/18 01:20
本文主要是简单介绍下git的基本用法
一、安装
linux中安装很简单,用apt-get install git(centos用yum) 就完成了安装。os x的话,用brew install git。安装好后,在终端敲git,显示如下表示安装成功。
appledeMacBook-Pro:~ apple$ gitusage: git [--version] [--help] [-C <path>] [-c name=value] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p | --paginate | --no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] <command> [<args>]安装后再配置下用户和密码
git config --global user.name "Your Name"git config --global user.email "email@example.com"
二、创建第一个仓库
appledeMacBook-Pro:~ apple$ mkdir test_gitappledeMacBook-Pro:~ apple$ cd test_gitappledeMacBook-Pro:test_git apple$ git initInitialized empty Git repository in /Users/apple/test_git/.git/
查看当前目录下是否有个.git目录
appledeMacBook-Pro:test_git apple$ ls -ah. .. .git
三、提交代码到仓库
添加文件到Git仓库,分两步:
appledeMacBook-Pro:test_git apple$ git add first.pyappledeMacBook-Pro:test_git apple$ git statusOn branch masterInitial commitChanges to be committed: (use "git rm --cached <file>..." to unstage) new file: first.pyappledeMacBook-Pro:test_git apple$ git commit -m "my first commit"[master (root-commit) a5813c6] my first commit 1 file changed, 1 insertion(+) create mode 100644 first.py
首先,你先将要提交的文件用git add <file_name> 加入缓存区(这时候你可以查看缓存区现在有什么东西改变),确定修改后用git commit -m "填写此次提交说明"
0 0
- git 基础版
- GIT基础
- GIT 基础
- git(基础)
- Git基础
- Git基础
- Git 基础
- Git基础
- Git 基础
- git基础
- git基础
- Git基础
- git 基础
- git基础
- Git 基础
- Git基础
- Git基础
- git基础
- 拍照或者从相册选择工具类
- MySQL创建用户与授权
- Eclipse 新建maven项目没有.classPath文件/不能创建新的资源文件/不能创建新的java类。。。。
- BringSubviewToFront sendSubviewToBack 小结
- ubuntu上外网
- git 基础版
- 转 JavaScript 获取鼠标点击位置坐标
- 数据结构与算法
- 【LinCV】Ubuntu 15.04下安装python2.7+openCV3.0
- NSDate的使用
- C# 从服务器下载文件代码
- mysql 数据库主从配置
- ios 3D引擎 SceneKit 开发(1) --起始篇
- 菜鸟学习中-修改select下拉框宽度