corresponding hello.txt file and find that the two lines you modified exist in the file in this form:
In this way, the content in different branches is marked and you need to manually change it and submit it with $ git add hello.txt and commit-M.
Use the $ git log with parameters to view the merging information. Take note of the parameters later.
$ git log --graph --pretty=oneline --abbrev-commit
3. Temporary Storage work site
You often encounter a situation where you are creating a new funct
git checkout-b dev # create dev branch, then switch to Dev Branch
The git branch command lists all branches, with an * number in front of the current branch
git merge Dev merges the work of the Dev branch into the master branch
git branch-d Dev removed the dev branch
Git merge--no-ff-m "merge with No-ff" Dev merges the branch code--NO-FF parameter, which means that fast forward is disabled so that branch information can be seen from the branch history.
Git
branch should be very stable, that is, to release the new version, generally do not allow work on the above, work in general in the new Dev branch work, after the completion, such as to publish, Or, if the dev branch code is stable, it can be merged into Master Branch master.Seven: Bug branches:In the development, will often encounter bug problems, then there is a bug need to fix, in Git, the branch is very powerful, each bug can be repaired by a temporary branch, after the completion of the re
branch is very powerful, each bug can be repaired by a temporary branch, after the completion of the repair, merge branches, and then delete the temporary branch.For example, when I get a 404 bug in development, we can create a 404 branch to fix it, but the work on the current dev branch is not yet committed. such as the following:It's not that I don't want to commit, but the work is done halfway through, and we're not able to commit it, such as my branch Bug, which takes 2 days to complete, bu
to fix, in Git, the branch is very powerful, each bug can be repaired by a temporary branch, after the completion of the repair, merge branches, and then delete the temporary branch.For example, when I get a 404 bug in development, we can create a 404 branch to fix it, but the work on the current dev branch is not yet committed. such as the following:It's not that I don't want to commit, but the work is done halfway through, and we're not able to commit it, such as my branch Bug, which takes 2
as to publish, Or, if the dev branch code is stable, it can be merged into Master Branch master.Seven: Bug branches:In the development, will often encounter bug problems, then there is a bug need to fix, in Git, the branch is very powerful, each bug can be repaired by a temporary branch, after the completion of the repair, merge branches, and then delete the temporary branch.For example, when I get a 404 bug in development, we can create a 404 branch to fix it, but the work on the current dev b
, whenever necessary, you can use the command GIT push Origin master to push the latest changes;Remote Library cloningTo clone a warehouse, you must first know the address of the warehouse and then clone it using the git clone command.GIT supports multiple protocols, including HTTPS, but the native GIT protocol supported by SSH is the fastest.View branches: Git branchCreate a branch: Git branch Switch branches: git checkout Create + switch branches: git checkout-b Merge a branch to the current b
to fix, in Git, the branch is very powerful, each bug can be repaired by a temporary branch, after the completion of the repair, merge branches, and then delete the temporary branch.For example, when I get a 404 bug in development, we can create a 404 branch to fix it, but the work on the current dev branch is not yet committed. such as the following:It's not that I don't want to commit, but the work is done halfway through, and we're not able to commit it, such as my branch Bug, which takes 2
as to publish, Or, if the dev branch code is stable, it can be merged into Master Branch master.Seven: Bug branches:In the development, will often encounter bug problems, then there is a bug need to fix, in Git, the branch is very powerful, each bug can be repaired by a temporary branch, after the completion of the repair, merge branches, and then delete the temporary branch.For example, when I get a 404 bug in development, we can create a 404 branch to fix it, but the work on the current dev b
in general in the new Dev branch work, after the completion, such as to publish, Or, if the dev branch code is stable, it can be merged into Master Branch master.Seven: Bug branches:In the development, will often encounter bug problems, then there is a bug need to fix, in Git, the branch is very powerful, each bug can be repaired by a temporary branch, after the completion of the repair, merge branches, and then delete the temporary branch.For example, when I get a 404 bug in development, we ca
branch is very powerful, each bug can be repaired by a temporary branch, after the completion of the repair, merge branches, and then delete the temporary branch.For example, when I get a 404 bug in development, we can create a 404 branch to fix it, but the work on the current dev branch is not yet committed. such as the following:It's not that I don't want to commit, but the work is done halfway through, and we're not able to commit it, such as my branch Bug, which takes 2 days to complete, bu
) $ git commit-m "fixed" [Master 51e165e] FixedThe message tells us that the problem has been resolved. Then we can delete the Dev2 branch.$ git branch-d dev2deleted branch Dev2 (was 046661c).! Note: Our previous split-to-merge operations are performed in quick mode, but when you delete a branch in this mode, the branch information is lost. Therefore, we can also adopt the No-ff method when merging the branches, as below, interested friends can test themselves.$ git nerge--no-ff-m "merge with No
Interactive_Rebasing.markdownNow we can see that the first 4 files have been staged, but the last one is not. Basically, this is a more compact way to view the state, and the actual information is consistent with the fact that we run ' git status ' on the command line:$ git statusVi. Storage 1. StorageWhen you are doing a complex job, you find a bug that is not relevant to your current job but is annoying. You want to fix the bug and do the work at hand, then you can use Git
use of branchinggit branch Git checkout-b Branching policy : First of all, themaster branch should be very stable, that is, only to release the new version, usually do not work on it; So where do you work? Work on the Dev Branch, that is, thedev branch is unstable, at some point, such as the 1.0 release, then merge the Dev branch to Master , in the master Branch Release version 1.0; You and your little friends each work on the Dev Branch, and everyone has their own branch, and it's time to me
the specified branch to the current branch, and discards the branch information after the branch is deleted.If a conflict occurs, Git uses to mark the contents of different branches. You need to modify and then run git commit .
$ git merge--no-ff-m "Submission Instructions"
It is recommended to use Normal mode to merge branches, the merged history has branches, can see that there has been a merger, and Fast forward merge can not be seen to have been merged.
$
: Delete files in your working directory that are not versioned by gitStashed Branches StashGit stash (Gsta): Move all staging area files to the "storage area", similar to another type of work areaGit stash list: View storage queue (Stash lists)Git stash apply: Restore the most recent storage to staging area (you can
files: Git ls-files–deletedRecovery requires the new Checkout:git checkout–Simultaneous operation of multiple files can be done using XargsGit ls-fies-d | Xargs git Checkout--git checkout-f recover deleted filesIgnore committing certain files or folders1. Writing a file name or directory name within a. gitignore file ignores the commit, but only for files or directories that are not track-only, and is not valid for files that have been added to the version management.2. Files or directories tha
--hard head^ back to the previous version, and if you accidentally change the wrong code, fall back to the previous version and modify it again.Git reset--hard version number refers to the top 5 digits.Git checkout-the file name directly discards the workspace modification and does not do add,commit operation.Git rest headIf it is already commit, the version is rolled back directly.Branchgit checkout-b git chekout Git branch View all branches with * Description is the branch of the current opera
file, I set Co as the checkout alias. Next time I use 'git Co new_branch ', I can switch to the new_branch branch, which is concise and elegant; set CI to the alias of commit-a. The-A option indicates that I do not need to add the modified and deleted files to the index using the 'git add' command, in this way, when the command 'git ci-M "message" 'is used, the command 'git add files modified and deleted 'and 'git commit-M "message' are executed consecutively, saving our precious time; the cool
work is not finished, first put the work site Git stash, and then to fix the bug, repair, then git stash pop, back to the job site.
Store current working state: Git Stash
View a list of stored work states: Git stash list
Retrieve work Status:
1, git stash apply (remove the
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.