MacOSX Git Manual

Summary

In HBuilderX, you have to install the Git plug-in before you can use Git.

HBuilderX Top menu, [Tool]-> [plug-in installation]. Open the plug-in installation window, Find Git, Click [Install].

MacOSX Git Manual - 图1

clone and import project

  • Top Menu, [File]-> [Import]-> [Import From Git]
  • HBuilderX Project manager, Right click menu [Import]-> [Import From Git]

MacOSX Git Manual - 图2

Git menu

In the project manager, select the project and right-click the menu to see the git related operation menu.

MacOSX Git Manual - 图3

Pull

git-pull - In explorer, select a project and right-click mouse, then click [Git Pull] from menus.

MacOSX Git Manual - 图4

Push

git-push - In explorer, select a project and right-click mouse, then click [Git Push] from menus.

MacOSX Git Manual - 图5

Remark:git push —force: It means to push the current code library of your own computer to the remote server and overwrite it. Please use it with caution.

Commit

  1. Select the file or the directory or the project to be submitted, right-click the menu and click [Git Commit]
  2. In the pop-up window, enter the commit message and click the [Commit] button.

MacOSX Git Manual - 图6

View Log

Selected Project,right-click menu [Git]->[View Log]

MacOSX Git Manual - 图7

Branch

  • New Branch: Selected Project, right-click menu【Git】-> 【Git New Branch】
  • Switch Branch:Selected Project, right-click menu【Git】-> 【Git Switch Branch-Checkoutf】
  • Delete Branch:Selected Project, right-click menu【Git】-> 【Git Delete Branch】
  • Merge Bbranch:Selected Project, right-click menu【Git】-> 【Git Merge Branch】

MacOSX Git Manual - 图8

Shortcut Configuration

  1. Top menu, 【Tool】—>【Custom Keybindings】
  2. All Git command configurations can be seen at the bottom of the left side of the document
  1. //git pull
  2. //{"key":"","command":"ExternalCommand:GIT_PULL"},
  3. //git push
  4. //{"key":"","command":"ExternalCommand:GIT_PUSH"},
  5. //git rm file
  6. //{"key":"","command":"ExternalCommand:GIT_REMOVE"},
  7. //git add File
  8. //{"key":"","command":"ExternalCommand:GIT_ADD"},
  9. //git switch branch
  10. //{"key":"","command":"ExternalCommand:GIT_CHECKOUT_BRANCH"},
  11. //git status
  12. //{"key":"","command":"ExternalCommand:GIT_STATUS"},
  13. //git reset
  14. //{"key":"","command":"ExternalCommand:GIT_RESET"}

Select the required command and copy it to the right, configure your own shortcut keys

Example:

  1. [
  2. {"key":"command+alt+u","command":"ExternalCommand:GIT_PULL"}
  3. ]

Q:git xcrun error

Error encountered when using git:

  1. xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Solution, open the terminal and enter the following command:

  1. xcode-select --install