Simple use of git under Linux

What is git?

Two major functions of git

1. Carry out version management (version control)

2. Multi-person collaboration

Install git

yum install git

client client and server server

How to use git

git --vecsion Check whether git is installed

Copy your remote repository over

git clone address

[ycc@iZbp1czm5p4go6poel4l8tZ ~]$ git clone https://gitee.com/Sorrow-is-meaningless/room-c-in-the-north-and-south.git

Copy the file to your warehouse directory

Then add the file to the local repository

One more thing to add here is that when creating a warehouse

Remember to add the .gitignore file, which contains some suffix files. All files with these suffix names will be filtered out when submitted.

three-axe

git add . All files in the current directory that have not been added before

git commit -m "commit log"

[ycc@iZbp1czm5p4go6poel4l8tZ linux_c]$ git commit -m "提交测试"
[master 61a5b0b] 提交测试
 1 file changed, 32 insertions(+)
 create mode 100644 mycode.c

git push

git log to view commit records

git stauct to view files that have not been uploaded

[ycc@iZbp1czm5p4go6poel4l8tZ linux_c]$ git stauct
git: 'stauct' is not a git command. See 'git --help'.
[ycc@iZbp1czm5p4go6poel4l8tZ linux_c]$ git status
# On branch master
nothing to commit, working directory clean
[ycc@iZbp1czm5p4go6poel4l8tZ linux_c]$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#   (use "git push" to publish your local commits)
#
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   test4.c
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	test3.c

vim .gitignore (view filtered suffix files)

1: .gitignore  ⮀                                                                                  ⮂⮂ buffers 
  1 # Prerequisites
  2 *.d
  3 
  4 # Object files
  5 *.o
  6 *.ko
  7 *.obj
  8 *.elf
  9 
 10 # Linker output
 11 *.ilk
 12 *.map
 13 *.exp
 14 
 15 # Precompiled Headers
 16 *.gch
 17 *.pch
 18 
 19 # Libraries
 20 *.lib
 21 *.a
 22 *.la
 23 *.lo
 24                                                                                                             
 25 # Shared objects (inc. Windows DLLs)
 26 *.dll
 27 *.so
 28 *.so.*
 29 *.dylib

Modify the suffix file and remember to add *

When using git for the first time, you need to configure your email and user name (two commands need to be executed)

git config --global user.name "Your name"

git config --global user.email "[email protected]"

Note: To execute separately, enter your name in the first sentence and your email in the second sentence.

effect

In order to easily find the person responsible for the code, trace the source of the code

Supongo que te gusta

Origin blog.csdn.net/2202_75625589/article/details/131869546
Recomendado
Clasificación