Git的使用

1. git init

2. git config user.name ""

    git config user.name ""

3. 现实隐藏文件

4. touch mian.m

查看文件状态 git status

Initial commit

Untracked files:

  (use "git add <file>..." to include in what will be committed)

main.m // 标新添加的文件或者新修改的文件没有别添加的暂缓区中

5. 

Initial commit

Changes to be committed:

  (use "git rm --cached <file>..." to unstage)

 new file:   main.m

可以提交到代码 

git add 和git commit 的区别 

1. add 提交的长裤

2.commit 提交分支

6. open main.m 打开修改的文件

7. 给git取别名

git config alias.st "status"

git config alias.ci "status"

8. 产看历史版本

 git log

.git 版本号

git 版本回退

.git reset --hard HEAD

.git reset -- hard HEAD ^^

.git reset -- hard HEAD ~100

.git reset --   hard 版本号前 7位

10. -- global的作用 

11 共享git 

git init --bare

通过git clone 将共享的克隆到本地

项目经理初始化: 项目有一大堆需要忽略的文件

cd WeiXin

touch  .gitignore

open   .gitignore

需要忽略哪些文件  查找需要忽略的内容

将 .gitigore 添加到本地长裤管理中

git commit 

localhost:WeiXin zhangdefu$ git add . // 中间有空一个空格

localhost:WeiXin zhangdefu$ git status 

/******

# Xcode
  #
  # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
   
  ## Build generated
  build/
  DerivedData/
   
  ## Various settings
  *.pbxuser
  !default.pbxuser
  *.mode1v3
  !default.mode1v3
  *.mode2v3
  !default.mode2v3
  *.perspectivev3
  !default.perspectivev3
  xcuserdata/
   
  ## Other
  *.moved-aside
  *.xcuserstate
   
  ## Obj-C/Swift specific
  *.hmap
  *.ipa
  *.dSYM.zip
  *.dSYM
   
  # CocoaPods
  #
  # We recommend against adding the Pods directory to your .gitignore. However
  # you should judge for yourself, the pros and cons are mentioned at:
  # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
  #
  # Pods/
   
  # Carthage
  #
  # Add this line if you want to avoid checking in source code from Carthage dependencies.
  # Carthage/Checkouts
   
  Carthage/Build
   
  # fastlane
  #
  # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
  # screenshots whenever they are needed.
  # For more information about the recommended setup visit:
  # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
   
  fastlane/report.xml
  fastlane/Preview.html
  fastlane/screenshots
  fastlane/test_output
   
  # Code Injection
  #
  # After new code Injection tools there's a generated folder /iOSInjectionProject
  # https://github.com/johnno1962/injectionforxcode
   
  iOSInjectionProject/

localhost:WeiXin zhangdefu$ git commit -m "注释"

// git提交的时候 出现的问题 那么输入下面的命令  Couldn’t communicate with a helper application.

localhost:WeiXin zhangdefu$ xcrun git config --global user.email 1018475062@qq.com

localhost:WeiXin zhangdefu$ xcrun git config --global user.name name

localhost:WeiXin zhangdefu$

原文地址:https://www.cnblogs.com/1018475062qq/p/6243090.html