Master is the main branch of the project, points to the project version, head is the latest version of the main branch of the project, pointing to the main line namegit checkout-b Dev//Create the Dev branch and switch to the branch, equivalent to:Git branch Dev//Create a branchgit checkout Dev//Switch BranchesGit branch//View Current Branchgit merge Dev//switch to the other, then merge the Dev branch into the current branchgit branch-d Dev//Remove Dev Branchgit log--graph--pretty=noline--abbrev-
The above command is equivalent to git branch newbranch and git checkout newbranch
2. Run the GIT branch command to view the current branch.
3. merge a branch to the current branch: git merge name
4. Delete branch: git branch-D name
5 disable fast forward: Add-no-FF to merge
If possible, git uses the "Fast Forward" mode when merging branches, but in this mode, branch information is lost after the branches are deleted. If you want to forcibly disable the "Fast Forward" mode, git will generate
] => occasional [28] => no best [30] => sedated incorrect operation [31] => The lighter the better [33] => The Last Resort was to change the route [34] => at will [35] => Shashi Road [36] => easy and comfortable [40] => never happened [43] => compete for the same lane, freely throwing garbage, changing lanes and turning without lights [44] => without seat belts, driving with slippers, driving, smoking, and drinking, without using children's seats [45] => keep speed, regular maintenance, selectio
is invisible to others:Git push originUpdate and mergeTo update your local repository to the latest changes, execute:Git pullTo get (fetch) in your working directory and merge (merge) remote changes.To merge other branches to your current branch (for example, master), execute:Git mergeIn both cases, git tries to automatically merge the changes. Unfortunately, this may not succeed every time and may result in conflicts ). At this time, you need to modify these files to manually merge these confl
Thanks to Liaoche, the great God shared git lessons
Master the following commands, basically daily enough local warehouse common operation to create a repository
Git init Add file to buffer
Git add file to warehouse
Git commit-m "Commint describtion" undo Modify or clear buffer
git reset/git reset HEAD file Discard or undo changes
Git checkout--file Delete
git rm fileEquivalent to git rm after git add undo Delete Operation
git resetgit checkout--file view specified file
Git cat file comparison w
personally configure the version that I don't want to upload to the server.So the choice of stash is to temporarily save the current file.At this point, the Java file in eclipse will be restored, and one more stash record will be saved with the files previously restored.Because this time the file has been restored, as well as the previous version of the history of the same, so can pull. We do pull.After th
/dev merges branch Dev with the current branch
Disable Fast forward Merge: $git merge--no-ff-m "comment" Dev
Fetch: $git pull gets and merges the current branch
Stash : Staging: $git Stash "Store" the current work site (git stash push) to view the job site: $git stash List recovery does not delete: $git
Branch
Create branch: git branch name
Switch branch: git checkout name
Create + switch branch: git checkout-B Name
Merge a branch to the current branch: git merge name
Delete branch: git branch-D name
11. Merge conflicts
When git cannot automatically merge branches, the conflict must be resolved first. After resolving the conflict, submit it again and merge it.
Run the GIT log-graph command to view the branch merge graph.
-- No-FF parameter, disable "Fast Forward": git merge -- no-FF-M "merge
--no-ff parameter can be combined with the normal mode, the merged history has branches, can see that there has been a merger, and Fast forward merge will not be seen to have been merged. (8) Staging management: When fixing a bug , we fix it by creating a new bug Branch, then merging and finally deleting the branch. When the work is not finished, first put the work site git stash , and then go to fix the bug, repair, then git
File: New filegit stash -uShow All stashesgit stash listGo back to the state of a stashgit stash apply {n}>Go back to the last stash state and remove this stashgit stash popDelete all the stashgit stash clearTo take out a file mo
Here are two ways of doing it;One, using Git command-lineSecond, the use of GUI tools Sourcetree, the function is very powerful, very convenientBefore installing, git, like SVN, needs to create a server that can create its own version Management Server. For individuals and small teams, it may be more appropriate to use a managed server,Common to have GitHub and bitbucket. Here I introduce the next bitbucket
1. Open Sourcetree, enter settings-account;2. Choose Add Account, host select BitBucket (or github), connect account, login to existing BitBucket account (or GitHub account), save3. After successful connection, on the second step of the page will show your account name, SSH key under a "Copy to Clipboard" button, click to copy SSH key;4. Enter the BitBucket offic
From: http://blog.jobbole.com/53573/Work steps I will show you the following steps, usually helping me to do projects on one or more machines on my own.
Create a remote, empty code base (on BitBucket)
Add a project to the local code base
Develop new features on the branch
A) keep new features or b) discard them
Perhaps, back to an earlier point in time
To push the local code base to the remote code base
Get the remote
Forward模式,导致合并后删除原来的分支后,看不出主分支曾经合并过存档list恢复存档git stash apply 存档id删除存档git stash drop 存档id上面的恢复和删除可以用下面的命令合并操作git stash pop 存档id
When working in the current branch for a period of time temporarily need to switch to another branch, but the contents of the current branch cannot be submitted, this time can be used to use the command to log
, so with the-m parameter, write the commit description in:$ git merge--no-ff-m "merge with No-ff The Dev"Store" The current Job site:$ git stashview a list of stored work sites:$ git stash listRestore the "storage" work site and also delete the stash content:$ git stash popRestore the "storage" work site without deleting sta
. If you do, do not panic, because as long as git generally does not actively delete the contents of the local repository, depending on the situation you lost, can be retrieved, such as after the loss can use git reset--hard orig_head immediate recovery, or use Reflog command to view a reference to a previous branch.3.4 StashSometimes, we do some work on one branch and modify a lot of code, and then we need to switch to another branch to do something else. But do not want to do only half of the
, it's usually checkout to make sure there's no conflict.-M"Merge" //Tips for Merging*********************************************************************************************see the following situation to pay attention to conflict. Don't forget to resolve the conflict.*********************************************************************************************master should be published directly. So there should be no conflict when merging to master, so it is not recommended that multi
...//create and switch branches equivalent to git branch b_name git checkout b_nameGIT branch b_name//Create branch PS: Create branch clone from current branchgit checkout b_name//Toggle BranchGit branch//view Current Branch branch operation use this command plus option (-D Delete-D to delete an unincorporated branch) checkout just toggle (-B does not exist will be created)git merge b_name//merge current branch with specified branch--no-ff-m "commit_msg" commit record for this mergegit--graph--
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.