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
, and we can see that they have been merged, however, fast forward merge cannot be seen as a merger.
15. Bug Branch1. If you are currently developing on the dev branch, there is a bug that needs to be quickly resolved and merged to the master. In this case, you can create a new branch on the master (Named bug-101 ).The content on dev cannot be submitted, so you need to store it through git stash. After storing it, you can view that the work zone is c
When you update your code with GIT pull, you encounter the following problem:
Error:your local changes to the following files would is overwritten by merge: Please , commit Your changes or stash t Hem before you can merge. Aborting
This problem occurs because others have modified the xxx.php and submitted to the Repository, and you have modified the xxx.php, you have a git pull operation is a good conflict, the solution, in the above
b42294309188d57bf3398ed35660170a237d8c0aNote that the long string behind this is the SHA1 code for each commit.3. Switch to a branchgit checkout Testing4. Graphical display of branch informationGitkGITK--all5. MergeFirst, go to the branch you want to merge into, such asgit checkout MasterThe general will merge to master.and then callGit merge TestingThis will merge the changes on the testing branch.6. Delete BranchAll right, this branch, cut it out.git branch-d Testing7. Handling ConflictDuring
the last two commits, you need to run the following command.Git rebase-i head~2When you run the command, you'll see an interactive interface that lists a number of commits that let you choose which ones need to be compressed. Ideally, you choose the last commit and compress the other old commits.You will then be asked to enter the submission information for the new commit. This process essentially overrides your commit history.8.Stash UNCOMMITTED cha
in the workspace will become the non-developed Africa Zone feature before, it's so cool .Rollback is finished, small a in the thought if one day want to return to the version of the feature of the African zone what to do? Come on, you can't just look at the records and roll back through "git log" and go back to what you need to do:macbook-pro-4:p ondo jesi$ git reflog6c439d2 [email protected]{2}: Reset:moving to 6c439d2fd0d943f36f3ee84e158ff86b052961d20972f4b [Email protected]{3}: Commit: Afric
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 a bug urgently, you can save this progress, fix the bug to commit and then resume the work
=onelineWithout using fast forward mode, the principleBranching policy:In the actual development, we should follow several basic principles of branch Management:First of all, the master 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, the dev branch is unstable, at some point, such as the 1.0 release, then merge the Dev branch to master and release the 1.0 version in the Master branch;You and
information is discarded after the branch is deleted, that is, the merge cannot be seen once. Adding the--NO-FF parameter can prohibit the use of Fast forward mode, the merged history has branches, can be seen to have been merged.In the actual development, the master branch should be very stable, only to release the new version, usually do not work on it;The Dev branch is unstable, and at some point, the Dev branch is merged to master;Everyone works on the dev branch, and sometimes merges on th
The specific method is as followsGit pull Origin branch // error occurred git stash // Restore git stash ClearDevelopers often encounter this situation: It took a few days to do a new function, has changed almost more than 10 files, suddenly a bug needs to be resolved urgently, and then to a build test group. It's often time-consuming and error-prone to rely on manual backups before git comes out.The git
git logGit log-p: Show the differences for each commitGit log-p-X (x number of times, integer): Specifies the number of times the variance is displayedgit log--stat: Displays a brief count of incremental row countsgit log--author= cold Jiang: Show a commit record for an authorGit checkoutGit checkout--* * (file): Revert to file modificationGit checkout-b master remotes/master: Establish a local branch to the server and switch the pastgit branch-d: Delete local BranchGit branch-d: forcibly delete
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.