git版本控制总结
来源:互联网 发布:象屿集团怎么样知乎 编辑:程序博客网 时间:2024/05/17 03:58
// 1.初始化自己一个普通文件夹为本地仓库文件夹
git init
要初始化本地仓库的一些个人信息 , 也就是我们的用户名和email
git config user.name myname
git config user.email myemail
// 2.查看当前本地仓库的状态
git status
如果有要提交的东西会显示为红色(意味着需要把文件放入到临时仓库 == add)
// 如果有要提交的东西 会显示为红色
// 3.提交新的文件
a. 先add 会发现 文件会变绿 (放入到临时仓库)
b. 再提交 commit (提交到仓库)
commit之后会进入vim编辑器 写一些修改信息的描述
如果不想进入vim编辑器写描述信息 , 可以在 commit的之后直接加上描述
git commit -m"信息"
// 4.打印日志
git log
git reflog
// 5.回到某版本
git reset --hard 七位哈希值
git reset --hard HEAD^ // 回到前一个版本
// 6.提交之前想回到上一个版本
git reset --hard HEAD
或者
git checkout HEAD 文件名
// 7.查看所修改的地方
git diff
红色代表自己删除过的
绿色代表自己修改过的
// 远程仓库
// 1.初始化一个远程仓库
git init --bare
1,远程仓库仅仅是用来管理代码的, 不是用来存放代码
2,经理从远程仓库clone一份过来
git clone 远程仓库路径或网络地址
3,创建一个.gitignore文件
warning:.gitignore文件 一定要喝.git隐藏文件夹在同一目录下面
//
echo -e "# Xcode
#
build/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# Pods/" > .gitignore
//
4, add .gitignore 文件夹到临时仓库
5, 提交 .gitignore文件
git commit -m"信息"
6, 把工程提交到公司服务器
push
7, 员工应该首先从公司服务器吧代码clone下来 , 员工才能修改代码
git clone 公司服务器地址
usage: 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>]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Switch branches or restore working tree files
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty Git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
- git 版本控制总结
- git版本控制总结
- 使用git进行版本控制命令总结
- Java 版本控制工具-Git 学习总结
- 版本控制之Git---命令总结
- 版本控制之Git---错误总结
- Git版本控制:Git冲突解决 相关错误总结
- 版本控制工具git 和svn的学习总结1
- Git版本控制软件基本操作命令总结
- APP实用开发——版本控制Git使用总结
- GIT 版本控制软件(-)
- Git 版本控制
- git 版本控制
- 版本控制 git 应用
- 版本控制Git
- git版本控制
- 版本控制软件Git
- Git 版本控制
- 关于烂代码的那些事(上)
- Html5添加基于列表的选择美化插件教程
- 关于烂代码的那些事(中)
- PHPnow 升级 php 5.4 的方法
- 同态滤波
- git版本控制总结
- 关于烂代码的那些事(下)
- SMO推导和代码-记录毕业论文4
- UIAlertController
- UIImage 图片处理:截图,缩放,设定大小,存储
- (转)十进制与二进制互相转换
- 高性能MySQL(二):寻找瓶颈
- 很特别的一个动态规划入门教程
- 中国第一批操盘手下场