Version control, Git workflow, remote warehouse, basic git operations

What is version control

Version control refers to the management of changes in various program codes, configuration files, documentation and other files during the software development process. It is one of the core ideas of software configuration management.
The main function of version control is to track changes to files. It faithfully records information such as when and who changed what content of the file. Every time a file is changed, the file's version number will be incremented. In addition to recording version changes, another important function of version control is parallel development. Software development
is often a collaborative effort between multiple people. Version control can effectively solve version synchronization and development communication problems between different developers, and improve the efficiency of collaborative development. What is Git Git
is a free, open source distributed version control system designed to handle everything from small to large projects quickly and efficiently. Git is easy to learn, has a small footprint, and has lightning-fast performance. It features version control tools like Subversion, CVS, and features like cheap local branches, convenient staging areas, and multiple workflows.

Git workflow

Local workflow and basic concept
workspace : It is the directory you can see on your computer. Create a project on the local disk (usually done in the development tool).
Temporary storage area : It is called stage or index in English. It is generally stored in the index file (.git/index) under the .git directory. Add the workspace code to the temporary storage area. The temporary storage area code is temporarily stored and can be revoked. Version library: There is a hidden directory .git in the
workspace . It is a version library of Git. Submit the staging area code to the local warehouse and generate historical version records. The historical version records cannot be deleted. You can view the historical records submitted in different periods and compare them with other versions.
Insert image description here

Complete running process (local library and remote warehouse)

Insert image description here

  1. Workspace code is added to the staging area
  2. Submit the staging area code to the local repository
  3. Push the local repository code to the remote repository
  4. Pull code from the remote warehouse to the local
    description:
    workspace: workspace
    staging area: staging area/cache area
    local repository: or local warehouse
    remote repository: remote warehouse

Remote warehouse

The code hosting center is a remote code warehouse based on a network server. Generally, we simply call it a remote library.

local area network

GitLabe

internet

GitHub (external network) Gitee code cloud (domestic website)

git basic operations

Create the folder yourself: for example, name it E:\gitTest and use it as a warehouse

Initialize the git init warehouse name.
Insert image description here
You can create new files in the warehouse and simulate the files to be submitted.
Insert image description here

Submit to the staging area:
git add file name (submit the specified file)
git add . (submit all files)
git add -a (submit all changes to the staging area) View the git ls-files operation results
in the staging area :

Insert image description here
Insert image description here

Insert image description here

It can be viewed in the file. There is a plus icon in front of the file that has been added to the temporary storage area.
Restore the specified file in the temporary storage area to the workspace:
git reset file name. Undo the specified file
git reset. Undo all files.
Insert image description here
Submit to the local warehouse
git commit - m Comment
Insert image description here
Check the warehouse status
git status
Insert image description here
Clone the project
Here, take the open source project searched on gitee as an example, copy the URL to the pasteboard,
Insert image description here
Insert image description here
the operation results:
Insert image description here

Guess you like

Origin blog.csdn.net/crraxx/article/details/117431105