librarygit Add.git RM file name (including path) removes the specified file from gitgit clone git://github.com/schacon/grit.git pull the code down from the servergit config--list See all usersGit ls-files look at the already committedgit rm [file name] Delete a fileGit commit-a commits all changes to the current reposgit add [file name] Add a file to git indexGit commit-v you can see the difference in comm
can be discarded
The command git reset HEAD file can undo the staging area modification (unstage), re-put it back in the workspace, and then use git checkout -- file the discard work changes.
The command git rm is used to delete a file, and if it is found mistakenly deleted, replace the version git check
workspace: $git stash ApplyTo delete a restored frozen zone: $git stash dropRecovering and removing frozen areas: $git stash PopPush the specified branch to the remote library: $git pu
current master branch to the remote library
git clone https://github.com/tugenhua0707/testgit cloning from a remote repository
git checkout–b dev Create dev branch and switch to Dev branch
Git branch view all current branches
Git checkout master switches back to the master branch
First, use Git branch to create a branchUsage Scenario: No experience at the momentGit branch-a Show All branchesGit branch xx create XX branchgit checkout xx switch to XX branchGit checkout-b xx Create and switch to XX branchSecond, use Git stash save and restore work progressUsage scenario: Develop a new feature that has not been developed yet, but need to fix
Getting a Git Repository (get the project git repository) One initializes the new warehouse in the working directory: Git init After initialization, a directory named. Git appears in the current directory, and all of the data and resources that git needs are stored in this d
processed
Git push Origin branch name
11. Submit the Merge Request
After submitting the merge request, the code approval team colleagues will review the submitted code, and no problem will agree to merge requests and merge the code from the test branch into the master branch
Git using tips
The use of Stash
Sometimes there is a scenario where you
Cute new note-git problem (error: object file. git/objects/* is empty...) solution and understanding of git version library files, gitobjects file is too large
Due to improper operations, a major problem occurs in the git version library, as shown below:
error: object file .git
path) deletes the specified file from gitgit clone git://github.com/schacon/grit.git to pull code from the servergit config--list See all usersGit ls-files look has been submitted by thegit rm [file name] Deletes a fileGit commit-a commits all changes to the current reposgit add [file name] Adds a file to git indexGit commit-v you can see the difference between a commit when you use the-v argumentGit commi
documentation.txt
Git commit-m "documentation.txt file removed"
Git push
Reset GIT
If you want to reset your index and working directory to the status of your last commit or any commit, the terminal executes the following command:
Git reset -- hard commit number/HEAD
Git St
^ revert to the previous version (a ^ represents a version, or a ~[number] indicates the number of fallback versions)Branching PolicyThe General Master Branch is the most robust, used to release new versions, do not work on them, work on other branches, and then merge into Master. GIT branch [branch] creates a new branch git checkout [branch] switches to the specified branch (with the-B parameter indicating
use git checkout-file.txt undo the changes;If you not only change the mess, but also commit to the buffer, then commit to the buffer, then git reset HEAD file.txt, git checkout--file.txt;If you're messed up and you've committed to the repository, you'll need a fallback version of git reset--hard 123SDAIf you mess up a
branch. You can merge them on the dev branch from time to time.
3. Bug Branch
Git provides a stash function to "Store" the current work site and resume the work after it recovers:
$ git stash
Restore and delete the stash after fixing the bug.
$
Merging branches, plus the--NO-FF parameter can be combined with normal mode, the merged history has branches, can be seen
There have been mergers, and fast forward merge doesn't look like a merger.
Git also provides a stash feature that allows you to "store" your current work site and continue working after you resume the site:
Git
Simple Git command quick query table (Chinese Version)
Create
Copy A created warehouse:
$ git clone ssh://[emailprotected]/repo.git
Create a new local repository:
$ git init
Local Modification
Display the modified files in the working path:
$ git status
Different from the last submitted version file:
$
branches git branch-d dev #合并完成后, So we can delete the dev branch.
Note : When merging branches, the plus--no-ff parameter can be combined in normal mode, the merged history has branches, it can be seen that there has been a merger, and the fast-forward merge does not see that there has been a merger.
Use the following command to view the branch history git log-graph--pretty=oneline--abbrev-commit Bug Bran
file from gitgit clone git://github.com/schacon/grit.git pull the code down from the servergit config--list See all usersGit ls-files look at the already committedgit rm [file name] Delete a fileGit commit-a commits all changes to the current reposgit add [file name] Add a file to git indexGit commit-v you can see the difference in commit when you use the-v argumentGit commit-m "This is the message describ
LibrariesGit add.Git rm file name (including path) delete specified file from gitGit clone git: // github.com/schacon/grit.git pulls the code from the serverGit config -- list to view all usersGit ls-files to view submittedGit rm [file name] delete an objectGit commit-a submits all changes to the current reposGit add [file name] add a file to git indexGit commit-v: when you use the-v parameter, you can see
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.