Contents
- Introduction
- Prerequisites
- Fetch then Merge
- Pull
- Which approach should I use?
- IntelliJ's "Update Project"
- For Further Reading
Introduction
If you do not keep current with upstream, it will be more difficult to push your committed changes to the BASE repository
as your master's head and upstream master's head will not match.
You can use one of these methods to consume these changes:
- Fetch, then Merge
- Pull
- Update Project
This section covers how to keep your cloned repository up-to-date with the BASE repository.
Prerequisites
- You should first have your Squirrel environment setup in IntelliJ.
Fetch then Merge
This two step strategy provides more control over what changes you will allow into your active branch.
-
Navigate to VCS > Git > Fetch
-
Navigate to VCS > Git > Merge Changes
-
Any branches that need to be merged will be displayed; choose the branch(es) to merge to the current local branch
Select the Strategy and settings using the dialog box controls; default is recommended
-
Click Merge to begin the merge. If your master is ahead or behind the upstream master and you do a merge, Git will attempt to resolve non-conflicting differences. If successful, there is no more to do. If unsuccessful, you'll need to take action.
Merge strategies (default, resolve, recursive, octopus, ours, subtree) are not a trivial subject. The merge strategies that you specify for Pull also are used when you attempt to do a Push.If you'd like to learn more, there are links at the end of this section.
Pull
If you prefer one step, use Pull to bring down changes from upstream; this performs a fetch and merge.
-
Navigate to VCS > Git > Pull
-
You will then be prompted with Pull options
Note: Originally, you will be presented with the origin branch. This is not the one you want! Remember, always Pull from Upstream.
-
Select the upstream branch as your Remote and make sure that you check the branch which you want to merge
Which approach should I use?
It really depends on the degree of control which you want to exercise when consuming Upstream changes. If you want to selectively take in changes, definitely use Fetch and Merge.
However, given that we are consuming source AND Squirrel content from many teams, it will likely be to your advantage to consume these changes as a whole package to stay current. Hence the preference for Squirrels to utilize Pull.
IntelliJ's "Update Project"
There is an "Update Project" button in IntelliJ, which basically does a Pull and gives you the choice of merge vs rebase.
Update Type
This specifies the strategy for synchronizing your local repository with remote storage and how to clean locally. When you set these options, you are setting them for all Git version control roots.
Merge
Will perform a merge of upstream branches into your local branch, which is equivalent to:
1
2
3
class="highlight">1
2
3