We often encounter conflicts when using git rebase, pull, and push. At this time, we will go to merge:
$ git rebase master
Conflict:
$ git mergetool -t opendiff
Then, use opendiff to manually merge the conflicting location.
However, today I met a situation where
Sometimes a commit is too much, and maybe a commit just commits a small bug, so merging commits is imperative.There are two ways of doing this:One is to commit the last modified commit using parameters, and a previous commit will be merged into this commit commit:git commit-a--amend-m "My message here" if there was a commit before, and the information is:Git commit-a-M "My last Commit message"Then this commit message will not exist. However, the information for this commit has been merged into "
Basic concepts and commands
Branch: each commit, git Concatenates the submitted content into a timeline, which is a branch.
Create git checkout-B for git Branch
Git merge for GT Branch
Delete git branch-D from a
Method/Step
1 First we merge the main branch with the other branch and switch to the main branch . Span class= "Exp-album-enter-mask" > steps read
2 Second Step right-click Team---merge
3 After you pop up the merge box, it is recommended that you first merge locally and push to remote, select t
1. Click on the Red box area in the bottom right corner of idea.2, appears as follows, the first red box is the local dev merge, that is, from the local dev warehouse merge, the second red box indicates that can be from the remote git dev mergeA third red box indicates that the master merge can be from the remote.3, cl
We know that if you want to delete a branch after it has been merge to master, you can execute the command:
Git branch-d dev-new-featureThis allows us to delete the Dev-new-feature branch.
But if the branch that is going to be deleted is a branch that does not have a merge, there is a hint like this:
$ git branch
Tags: Android blog HTTP Io OS AR for SP File
Most of the online solutions are under the command line. I use egit, so I need to add the following sentence to the configuration file in eclipse (my version is Kepler.
Window-> preference-> Team-> Git-> Configuration-> repository settings-> select your repository and click Open
[Branch "master"]Remote = OriginMerge = refs/heads/Master
Second
1. Find the config file in the local project
Scatter a mergeIf you think your merged state is mess and you want to discard the current changes, you can use the following command to return to the previous state of the merge:$ git reset --hard HEADOr you've already submitted the merged code, but you want to scatter them:$ git reset --hard ORIG_HEADBut just now this command can be dangerous in some cases, and
not affect other people's work.In fact, the above is the rebase and merge different application scenarios.In the case of scenario 1, if you modify a bug in a common code, this is the time to put all the OEM version branches rebase to the branch to fix the bug, in the rebase process, Git will ask you to manually resolve the conflict on the code, All you need to do is put the bug fix code inside the target b
, the new branch then adds a lot of commits to the line 1 development, and when Master merges, it just moves the head pointer. However, if Master's head pointer commit ID does not exist on the new branch, Git will assume that someone else has submitted the content (including yourself) in master, and that the head pointer cannot be moved to the head of the new branch simply. You must merge the master's head
Second, the combined operation1, first modify the file as neededEcho >> Lz66303.txt2, then submit the modified file to the head buffer as needed, and record the change to the branchGit Commit-am "This was a commit created by lz66303."SummarizeIn fact, this person's favorite command git commit-am "" is not so omnipotent Ah!Okay, let's take a look at the help command git commit-h-A,--all commit all changed fi
In git, Please enter a commit message to explain why this merge is necessary., gitmerge
Please enter a commit message to explain why this merge is necessary.
Enter the submitted message to explain why this merge is necessary.
Git sometimes encounters this interface when
:
Switched to branch ' master '
To view the primary branch file:
– View file results: No files added in Branch1;
Androidmanifest.xml ic_launcher-web.png Res
assets Libs src
bin proguard-project.txt
Gen
Iv. Submission of Branches
Commit the Branch command: Submit the local branch to the GitHub;
V. Branch merging
Merge Branch command: After merging the branches, some of the f
Today, when you pull the server's code to local with Git pulls, you encounter an error, Your local changes to the following files would is overwritten by merge:, you can use the following methods to resolve:Method 1: If you want to keep the code that you have just modified locally and pull the code on the GIT server locally (the code you just modified will be tem
Excerpted from: CSDN Inverse cheersGit in pull, when this error occurs, many people may enter the stash, related stash see: Error pulling Origin:error:Your local changes to the following files would be overwritten by mergeBut after discovering stash still appears: Error pulling origin:error:The following untracked working tree files would be overwritten by merge ...In fact, you see the error hints, it is because some untracked working tree files cause
Create local libraries and fetch remote branches These previous steps are skipped here. Can self-Baidu.Workaround:1.cmd Enter the project's root directory.2. Execute the following command: Git pull Origin master --allow-unrelated-histories. can be submitted successfully. 3. Push again.There are other good ways to welcome the proposal.Android Studio appears when submitting to open source git: fatal:refusing
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.