Forked from bitpay/cordova-plugin-qrscanner
git clone https://github.com/chaiwei/cordova-plugin-qrscanner.git
cd cordova-plugin-qrscanner
// Add the remote repository of the v1934's fork from which I want to pull the changes:
git remote add upstream [email protected]:v1934/cordova-plugin-qrscanner-11.git
// Fetch the latest changes from the remote repository:
git fetch upstream
git merge upstream/master
// Merge the changes into local branch
git push origin master
Notes
Here are a few reasons why you might want to split fetch and merge:
Clarity and Control: By explicitly running git fetch, you can see what changes are being brought in from the remote repository without automatically merging them into your local branch. This allows you to review the changes before merging and ensures you know exactly what is coming in.
Avoiding Unwanted Merges: When you use git pull, it will automatically attempt to merge the changes fetched from the remote repository into your current branch. If you have any local changes that conflict with the fetched changes, Git will create a merge commit. Sometimes, you might not want to automatically merge changes, especially if you're not prepared to handle potential conflicts.
Separating Concerns: Fetching and merging are two distinct actions. Fetching updates your local copy of the remote repository without affecting your current working branch. Merging, on the other hand, brings those changes into your working branch. Separating these actions can make your workflow more organized and easier to manage.
Review before Merging: Fetching first allows you to review the changes from the other person's fork before merging them into your own fork. You can inspect the commits, read the commit messages, and verify that everything looks good before integrating the changes into your project.
By using git fetch
and git merge
separately, you gain more visibility and control over the process, which can be beneficial when dealing with multiple forks and repositories. However, if you're confident that the changes in the other person's fork won't conflict with your local changes, and you don't need to review them separately, you can use git pull as a more convenient way to combine both steps.