git版本控制总结

// 创建本地仓库

// 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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值