Pure record, no classification
Tips
- Do not operate on dev.
- Git update-
Temporarily save the modified file
Git add. Git addCopy the code
Undo the local modify file
Git checkout [fileName] -- Git checkoutCopy the code
Submit the temporary storage area file
- Fix: Fixes bugs
- Update: Updates a file
- Add: Adds a file
- Modify: rename the file
- Delete: deletes a file
Git commit -m
If you don’t want to commit, store
Stash stash pop/apply stash stash save'message'-- Stash is a message git stash drop stash@{$num} -- discard stash@{$num} store, remove this store from the list git Stash clear -- remove all cached stash stashCopy the code
Push code from the local repository to the remote branch
Git push [remote branch name]Copy the code
Switch branch
> git checkout [branch name you want to switch to]Copy the code
Note: Be sure to commit or put the modified file into storage before switching branches
Pull the remote branch code
Git pull orgin [branch name] Git pull -- the code that pulls the current branchCopy the code
Merging branches
Git merge git mergeCopy the code
Viewing local branches
git branch
Copy the code
Viewing remote branches
git branch -a
Copy the code
Changing the branch Name
git branch -m ordBranch newBranch
Deleting a Local Branch
Git branch -d/ -d
Deleting a Remote Branch
Git push origin --delete
Is equivalent to
Git push origin:
Local branches are pushed to remote and associated
git push --set-upstream origin _branch
Viewing the Submission Record
git log
git log-5 View five recordsCopy the code
View the deleted commit record
git reflog
Roll back the code
Git reset --hard [commitIdCopy the code
Push the code
Git push orgin [current branch]:devlop
Connecting a remote warehouse
Git remote add origin warehouse address Warehouse address: https://git.coding.net/xxxxxxxxxxxxx/my-project.git git push -u orgin masterCopy the code
Deleting a remote repository
git remote remove origin
Remote repository deleted, local branch not deleted
Git remote show origin Displays information about remote branches. Git remote prune Origin --dry-run Displays information about remote branches that can be cleanedCopy the code
Remember the remote Git repository account password
Permanent record
git config --global credential.helper store
Custom remember time – 1 hour
Git config credential.helper 'cache - timeout=3600'
Reset git password
git config --unset credential.helper
Example Modify the remote repository name
git remote set-url origin []
Clone a branch directly:
git clone -b <branch name> [remote repository address]
Git log Common commands
View the submission of the author
Git log --author= something
View the submitted file
git log --stat
View submitted file modifications
git log -p
View the commit record by row
git log --pretty=oneline
Displays the list of new, modified, and deleted files.
git log --name-status
Find commits that add or remove references to a particular function, such as modal-Wrapper
git log -Smodal-wrapper