

Feel free to share if you found this useful 😃. gh repo fork repository -remotetrue To specify the remote repositorys name, use the -remote-name flag. Now you are synced with the main (or master) branch of upstream. To configure a remote repository for the forked repository, use the -remote flag. To merge the main or master branch of the main repository you can use this command, git merge upstream/main Step 3: Merge the main or master branch of upstream (main repository) Info: master branch name is now main if you are using Github. This will fetch all the latest commits, branches, etc from the main repository. In the dialog that opens, specify the remote name and URL and click OK. Click the Add button on the toolbar or press Ctrl+N. You saved the family You can now see both the original repository and the fork: git remote -v origin (fetch) origin (push) upstream (fetch). If you dont have an upstream you can easily add it with the remote command. We need to configure this information to restore the family relationship by adding a new remote upstream repository: git remote add upstream. git remote add -f upstream ssh://gitpagure.io/pagure.git. From the main menu, choose Git Manage Remotes. Our brief tutorial will get you started using git upstream to maintain a. To get the latest commits from the upstream (the main repository) you need to use this command, git fetch upstream When contributing to a project on Pagure, the first step is to fork it. You need to replace with the main repository Git URL. Let's call the main repository upstream and let's add a pointer to the main repository using this command, git remote add upstream git remote add upstream The second version of the command will show you the remotes currently configured for your project. So There should be a pointer to the main repository. The first command will add a remote repository with the name given (in this case upstream) and pointing to the indicated URL. The origin here means our fork of the main repository which is not what we want (Because the fork contains only our latest commits. It may show something like this, origin (fetch)

You can also use git remote add upstream to achieve the same result. We can check this using this command, git remote -v You can use repository mirroring to keep your fork synced with the original repository.

Step 1: Check if the main repository is added as a pointer!īefore starting we need to make sure that we have a pointer to the main repository to fetch the latest commits. First, you need to fetch all the latest commits and branches from the remote main repository. To sync a forked repository with the main remote repository in Git. The local repos could cleanly track one remote.
#GIT ADD REMOTE FORK HOW TO#
How to sync the fork repository with the main repository in Git? github should add a button / function for doing this frequently needed (fast-forward) re-sync from upstream without needing that triangle process via local repo + commandline.
