Part one: Git configuration

  1. Git config -l
  2. Git config –system –list
  3. Git config –global –list

The git-related configuration files are stored in the local system directory: gitconfig directory of the Git installation directory. Gitconfig directory of the user directory

  1. Git config –global user.name “jeffduuuu”

The second part creates a Git project

  1. Initialize the project git init
  2. Git clone HTTPS/SSH

The third part git file operation

  1. Git status [filename]
  2. Commit to staging git add. #
  3. Git commit -m “new file hello. TXT “# -m
  4. Git merge [branch]

Part 4 git undo and rollback

  1. Before git commit and not added to staging area

Git checkout — [filePath] Git reset HEAD [filePath] git update [commitid

The appendix

  1. Four states of Git files

Version control is the version control of a file. To modify or submit a file, you must first know the current state of the file. Otherwise, you may submit a file that you do not want to submit now, or the file to be submitted is not submitted.

  • Untracked: Not tracked. This file is in a folder but is not added to a Git repository and is not involved in version control. Git The Add state becomes Staged.
  • Unmodify: Indicates that the file is imported and not modified. That is, the snapshot content of the file in the version library is the same as that in the folder. A file of this type can be Modified in two ways. If it is Modified, it becomes Modified. If you use Git rm to move the library, it is an Untracked file
  • Modified: The file has been Modified, only Modified, without any other action. This file also has two places to go. Git add allows you to enter staged modifications, and git checkout allows you to discard the modifications and return to the unmodify state. This git checkout removes the file from the library and overwrites the current modification
  • Passage Ten: Staged state Git commit synchronizes the changes to the repository. The files in the repository and the local file become the same again. The file is not Unmodify. Run git reset HEAD filename to cancel the temporary save, the file state is not Modified
  1. Git submission process