When using git pull code, you often encounter conflicting situations, prompting the following information:
Error:your local changes to ' C/ENVIRON.C ' would is overwritten by merge. Aborting.Please, commit your changes or stash them before you can merge.This means that there is a conflict between the updated content and the locally modified content, either by committing your changes or by temporarily storing the local changes first.
The process is
greater the responsibility. When executing git rebase, you may encounter merge conflicts. Merge conflicts indicate that the two submitted and modified the same row of the same file, and Git does not know which modification of the application. This will cause the following error message:
Now, the working directory is clean:
$ git status# On branch featurenothing to commit, working directory clean
In this case, you can switch the branch securely to do other things. But don't worry, the temporary
What should I do if the gitpull file conflicts with the local file? When using git pull code, conflicts often occur and the following information is prompted:
Error: Your local changes to 'C/environ. c' wocould be overwritten by merge. Aborting.Please, commit your changes or stash them before you can merge.This means that the updated content conflicts with the locally modified content. submit your changes or temporarily store the local changes.
Th
the branch, and then delete the temporary branch.
git stash: The current work site "storage", and so on after the resumption of the site to continue to workgit stash list: View the job site just now git stash apply : Reply to work sitegit stash drop: Delete Stash Conte
to be disabled, Fast forward git will generate a new commit at merge, so that branching information can be seen from the branch history
git merge --no-ff -m "merge with with no-ff" devPrepare to merge the Dev branch, note that the --no-ff parameter means disable Fast forward, because this merge creates a new commit, so with the-m parameter, write the commit description in
Bug BranchGit also provides a stash function that can "store" the
checkout: readme.txtplease, commit Your change s or stash them before you can switch branches.
The solution to this problem is the git stash command.
The command can get the middle state of the working directory-that is, the modified tracked file and the staged change-and save it to a stack of unfinished changes that can be re-applied at any time.
After running the "git
After mastering the basics of Git use, you may encounter some common problems. The following are some of the problems that cat Brother screening summary, share to friends, master the points in these questions, Git advanced also completed, it contains the following sections:
How to modify Origin warehouse information
How to configure Git ssh keys
How to undo Changes
How to solve the conflict
Git stash/alias/submodule usage issu
Restore"Git checkout--Create SSH Key$ ssh-keygen-t rsa-c "[Email protected]"Associate a remote warehouse Xx.git remote Warehouse AddressGit remote add Origin xx.gitThe first time you push all the contents of the master branchGit push-u Origin MasterTo 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.git clone xx.gitView B
file to the previous version: git reset -- hard HEAD ^
View Command records: git reflog
Branch Operations
Create branch: git branch dev
Create and switch to the branch: git checkout-B dev
Switch branch: git checkout master
Delete branch: git branch-d dev
Merge with current branch: git merge dev
View branch: git branch
Remote warehouse operations
Create an SSH Key: ssh-keygen-t rsa-C "youremail@example.com"
Cl
When working with Git pull code, colleagues often encounter conflicting situations, prompting the following information:
Error:your local changes to ' C/ENVIRON.C ' would is overwritten by merge. Aborting.
Please, commit your changes or stash them before you can merge.
This means that there is a conflict between the updated content and the locally modified content, either by committing your changes or by temporarily storing the local changes first.
publish, or after the dev branch code is stable, it can be merged to the master branch.
7. Bug Branch:
During development, bugs are often encountered, so Bugs need to be fixed. In git, the branches are very powerful, and each bug can be fixed through a temporary branch, after the repair is completed, merge the branches and delete the temporary branches.
For example, when I receive a 404 bug during development, we can create a 404 branch to fix it. However, the work on the current Dev branch has
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
or undo Modify command:#在Git中, head represents the current version, the previous version is head^, the last version is head^^, the last 100 versions arehead~ID> -- Hard head^ file name> --file name> #撤销工作区的修改 Branch operations related commands (master Main branch, head pointing to current branch):Git branch #查看分支 with * -B #创建并切换到指定分支git checkout-b -D name>-D forward mode) #当Git无法自动合并分支时, must resolve the conflict first, then submit, Merge Complete(Bran
simplified output)15, non-rapid merger (teamwork): If you use quick Merge, merging and deleting branches will not be able to see that there have been branches, so you can use a non-quick merge.Enter git merge--no-ff-m "..." directive, parameter--NO-FF indicates a non-fast merge, because this merge is to create a new commit, so add-m parameter and fill in the description.In team development, the master branch is used only to publish new versions, usually working on the dev branch. Everyone has a
the SSH service did not start (akzent)) the-u parameter associates the local and remote master to clone from the remote library: Git clone[email protected]: themoonstone/ubuntu_git.git Create and switch new branch: git checkout-b newbranch parameter-B to create and switch branch merge: git merge newbranch git Merge: Merge specified branch to current branch Delete branch: git branch-d oldbranch Force Delete branch: git branch-d oldbranch View branch merge graph: git log--graph when merging bra
clone a remote Git project locally as well:+ open git bash,mkdir xxx cd xxx
git init
git config--global user.name ' andyliwr '
git config--gloabl user.email ' 121960425@qq.com '
git Remote add-f-T Master-m Master Origin https://github.com/Andyliwr/blog.git
Git merge origin
7. If a permission error occurs when cloning a remote project.
Solution :+ First Look at the local there is no SSH key (generally in/c/users/andyliwr/.ssh/id_rsa.pub)+ If not, use ssh-keygen-t rsa-c "lidikang@idwzx.com" to
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 stash the job site and now sees the contents of the current branch
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
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.