Commonly used commands in git

Steps to submit code in git:

git pull retrieves the update of a branch of the remote host and merges it with the local designated branch.
git status View the current status
git add + file
git add -u + path: submit the modified tracked code to the cache
git add -A + path: submit the modified untracked code to the cache
git add -u com/ breakyizhan/src
submits the modified code tracked in the com/breakyizhan/src directory to the cache
git commit -m "fix XXbug" Push the modification to the local git repository
git push Push the code currently submitted to the git local repository To a remote point of the remote host

Steps to create a new git feature branch:

Git branch name Create a branch named name
Git checkout xxx_dev Switch to a branch named xxx_dev
Git pull Pull code from a remote branch to a local branch
Git checkout -b main_furture_xxx Create and switch to main_furture_xxx branch
Git push origin main_furture_xxx Perform push operations Complete the synchronization of the local branch to the remote branch

Two methods and differences of GIT merger:

There are two types of Git code merging: Git Merge and Git ReBase

Git Merge: It merges the history of the two branches together. The current branch will not be changed. It will compare the different files of the two parties and cache them, generate a commit, and push.

Git ReBase: This merge method is often called "rebase". He submits the modification history, compares the commits of both parties, and then finds out the difference to cache, then pushes to modify the commit history.

Commands for adding new files: git add file or git add.
Commands for submitting files: git commit -m or git commit -a to
view the status of the workspace: git status -s to
pull and merge remote branches: git fetch/git merge or git pull
view submission record command: git reflog

For reference: https://blog.csdn.net/halaoda/article/details/78661334?utm_medium=distribute.pc_relevant_t0.none-task-blog-OPENSEARCH-1.control&depth_1-utm_source=distribute.pc_relevant_t0.none-task -blog-OPENSEARCH-1.control

Guess you like

Origin blog.csdn.net/Menqq/article/details/111455355