, delete, retrieve, reset modified files
git help
View File diff
git help
View Commit record
git log git log
TIG
you can use TIG instead of diff and Log,brew install TIG on your Mac
Git Local
Today we continue our git tutorial, the Git Killer feature is for branch management, so today it's about the merge operation between branches. Merge can be said to be one of our most frequently used operations, and a merge operation typically contains commit, pull, push, and so on. Used to use the SVN's friends may feel git
Branch IntroductionMultiple branches are lines of records that have multiple commits in the repository, as shown in the blue Master is a branch, the Red Dev is also a branch, and the head refers to the current branch:What is the use of branching in practice? Suppose you are ready to develop a new feature, but it takes two weeks to complete, the first week you wri
Local has two branches A and b,a are release versions, B is the development version. According to the truth, a branch of the content is generally can not be arbitrarily changed, we just develop branch B on the line. Finish it again.
But today, I have a problem, that is, I did a move under branch B,
Recent server migration, and the original local development is to switch between different branches in the same directory, feel a bit frustrated, so you want a file directory to a branch, so there is not too much file differences.
This operation is recorded and may be used later.
This is generally the case with git initialization.
GIT supports a wide variety of workflows, which we typically use to create a master branch remotely, create a functional branch for each person, and work through the following routines:Go to your own branch of work$
replacing the content with the following:
Printf ("Test2 ″);
This solution each adopts part of the two branches and deletesThese rows. After resolving all conflicts in all files, run git addMark them as resolved ). Once saved, the conflict is resolved. If you want to use a graphical tool to solve these problems, run gitMergetool, which calls a visual merge tool and guides you through solving all conflicts:
$ Git
database host name, and the master is the local branch name. If the remote branch does not exist, it will be created.Enter the git user password to complete the push.If the remote repository is not empty, run pull to retrieve updates from a branch of the remote host and mer
Sometimes git clones come down with a lot of branch, and the trouble is that if the main branch doesn't have code then you can only see the. git directory. As in the following:$ git clonegit://gitorious.org/android-eeepc/mesa.gitDiscover that there is only one.
Sometimes git clones come down with a lot of branch, and the trouble is that if the main branch doesn't have code then you can only see the. git directory. As in the following:$ git clonegit://gitorious.org/android-eeepc/mesa.gitDiscover that there is only one.
git reset [commit hash]However, this only allows the local branch to be rolled back to the commit, and the remote branch is in its original place.You can do this: create a new branch on the commit you want to roll back, then
Collaborative development using Git Branch
In large-scale software project development, the use of multiple branches can not only develop multi-module tasks in parallel, but also avoid introducing new function code During Bug fixes or accidentally deleting the Bug code to fix and reproduce the problem, clearer development of 'Organizational 'projects.
The new branches generally fall into the following three
follows:
# # Parses out of the branch name from. Git/head:
Find_git_branch () {
Local dir=. Head
Until ["$dir"-ef/]; Todo
If [f "$dir/.git/head"]; Then
Head=$ (if [[$head = Ref:\ refs/heads/*]]; Then
Git_branch= "→${head#*/*/}"
elif [[$head!= ']]; Then
Git_branch= "→ (detached)"
Else
Git_branch= "→ (unk
Git branchGit branch takes no parameters: Lists the branches that already exist locally, and adds the "*" sign to the front of the current branch, for example:#git Branch* MasterNewbranchgit branch-r lists remote branches, for exa
1, from the Remote Repository clone project to the local, in addition to create a current remote head pointer to the branch, but also copy the remote Repository branch to the local, can be through git
If you want to fetch a branch on GitHub to the local machine, directly enter the following command:
Git checkout origin/
Result error:
Error: pathspec 'origin/feature_renrendai_tongji 'did not match any file (s) known to git.
See http://stackoverflow.com/questions/5989592/
Transferred from: http://www.barretlee.com/blog/2014/04/30/switch-branch-in-git/
Remote repository git clone down and when you execute GIT branch, you'll only see* masterDo not see other branches, even if there are other branches on the remote repository, use thegit
Rebase the local current code and the master branch of the remote code, where origin is the local alias of the remote repository
Git push Origin Master:master
Push the changes to the remote repository, as described in the following command, which means: Push the
The following error occurred while creating the remote branch:
$ git checkout-b dev origin/dev
fatal:cannot update paths and switch to branch ' Dev ' at the same time.
Did you intend to checkout ' origin/dev ' which can isn't be resolved as commit?
Internet search a lot of information can not solve, finally to the StackOverflow found the answer: link
Translat
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.