Skip to main content
55 events
when toggle format what by license comment
S May 24 at 2:45 history suggested Aiden Cullo CC BY-SA 4.0
master -> main
May 22 at 15:56 review Suggested edits
S May 24 at 2:45
Oct 23, 2023 at 13:44 comment added Daniel Saner @fIwJlxSzApHEZIl This is so important! The accepted answer here doesn't mention it, and I don't get why no tutorial seems to explicitly state this. I also had to learn the hard way: if you're working with a fork and intend to sync with changes from upstream later, never work directly on branches you got from upstream. Create your own branch, then merge/rebase changes from upstream into it to sync. If you're working on an original development branch, you can only merge/rebase once. The next time, it will explode with conflicts for every commit upstream made in the meantime.
Jun 15, 2023 at 1:49 comment added fIwJlxSzApHEZIl I did this twice and still had commits that were out of sync from the remote. What's worse is that it was the same original commits that were out of sync except that rebase re-created them so the timestamps were updated and I had to go through each and every commit to work through merge conflicts. So I did a ton of work for zero benefit. The only thing that worked was git reset --hard upstream/main && git push -f. Note that will will destroy all local work in your fork but if you're using the fork and pull method this is fine. Also you should lock the fork as well to read only.
Mar 29, 2023 at 17:19 comment added Pradeep @MarkLongair When we do git rebase upstream/master or git merge upstream/master, what happens to the commits of other branches that we fetched as part of git fetch ? And is there any way to merge all the changes that are fetched from upstream (to their respective branches) ?
Oct 21, 2022 at 12:18 comment added Athanasios Salamanis In the context of open source software development, if the purpose of existence of a fork is for you to contribute to open source projects through PRs, then sync by rebasing (git rebase upstream/master). It creates cleaner commit history and cleaner future PRs. BUT, if the purpose of the fork is to create something entirely new based on an open source project (that other people will use), and in the middle of development you want for some reason to be synced with the upstream project, you should sync by merging (git merge upstream/master).
Oct 6, 2021 at 16:52 comment added testing_22 > "Remotes" are like nicknames for the URLs of repositories - origin is one, for example. Blew my mind
Jun 19, 2021 at 9:46 comment added Pradeep The 'master' branchname is changed to 'main' now ?
Jun 10, 2021 at 12:45 comment added Rahul Tiwari Makes me wonder do we have something better now from git in 2021 than to manually add, fetch upstream and rebase upstream/master ?
Jun 10, 2021 at 12:38 comment added Rahul Tiwari This was helpful. Could not find instructions for setting upstream in official git docs here
Jan 6, 2021 at 17:54 history bounty ended Naman
Jan 1, 2021 at 3:59 review Suggested edits
Jan 1, 2021 at 13:34
S Nov 24, 2020 at 10:50 history suggested CommunityBot CC BY-SA 4.0
Made more developer friendly
Nov 23, 2020 at 7:34 review Suggested edits
S Nov 24, 2020 at 10:50
Nov 19, 2020 at 13:47 history edited mate64 CC BY-SA 4.0
deleted 44 characters in body
Oct 21, 2020 at 21:19 history edited Yola CC BY-SA 4.0
added 19 characters in body
Oct 19, 2020 at 8:46 history bounty ended Naman
Oct 15, 2020 at 19:14 review Suggested edits
Oct 17, 2020 at 13:19
S Oct 13, 2020 at 8:39 history suggested Captain Charmi CC BY-SA 4.0
Master has been replaced with main.
Oct 12, 2020 at 17:41 review Suggested edits
S Oct 13, 2020 at 8:39
Aug 12, 2020 at 10:55 comment added 0andriy @jww there is no issues with SVN, you may always switch to it.
Mar 28, 2020 at 3:17 comment added DennisLi what if there is some conflicts after git rebase upstream/master? how to solve the conflict?
Nov 14, 2018 at 12:41 comment added Bruno Finger Git is so decentralized in a fashion you can merge a branch from a repo hosted on your local machine with no access to the internet, then merge it with a branch of another repo hosted on GitLab and finally rebase all of that into another repo hosted on GitHub.
S Apr 9, 2018 at 11:19 history suggested NearHuscarl CC BY-SA 3.0
color code block
Apr 9, 2018 at 10:20 review Suggested edits
S Apr 9, 2018 at 11:19
Feb 11, 2018 at 4:42 comment added Resigned June 2023 @Sinjai There is explicit support for these webservices. It's called the remote system. You specify the URL, and then push/pull. Speaking quite literally, I don't think it could possibly get any simpler without hardcoding support for some particular service. If Git were to have some kind of implicit understanding of the relationship between different repositories without you providing that information, it would require a centralized database. There's just no rational way to integrate this functionality into a distributed revision control system.
Feb 11, 2018 at 4:00 comment added Sinjai @RadonRosborough Sure, it just seems like there should be explicit support for those web services. It's not like Git would have to limit its support to just GitHub or BitBucket. It's a common use case that's more convoluted to apply than it needs to be. Though I suppose that's Git in a nutshell.
Feb 10, 2018 at 22:54 comment added Resigned June 2023 @Sinjai Yes, of course. That's why Git has explicit support for either applying patches from other people's changes, or for merging commits directly from other people's repositories (and it makes this last step extremely easy due to the support for a saved list of remotes). The thing that Git does not do is host a centralized webservice for hosting repositories in a standardized relational structure. It should be obvious, I think, why this latter thing is out of the scope of Git. And it's also why GitHub exists. And GitLab. And Bitbucket. Etc.
Feb 9, 2018 at 3:24 comment added Sinjai @RadonRosborough Surely the thought of creating derivations of open source projects was considered by someone before sites like GitHub, no? Though I suppose Git doesn't have anything to do with open source.
Feb 9, 2018 at 3:11 comment added Resigned June 2023 @Sinjai Yes. Separate copies of a Git repository have no relationship to one another, except one that exists in your mind or in external services such as GitHub (or that you implicitly create by creating remotes).
Feb 8, 2018 at 23:34 comment added Sinjai @Radon is "forking" a GitHub concept, introduced by the site rather than Git itself?
Jun 4, 2017 at 4:43 comment added Resigned June 2023 @jww: You ask why Git needs to be told about the original GitHub repository. It is because Git is a decentralized version control system and is not tied to GitHub in any way; it is probably obvious that Git was created before GitHub. When you create a forked repository on GitHub and clone it, GitHub knows that the repository is a fork; Git has no reason to, and does not. (Why doesn't the clone copy the Git remotes? Git is decentralized; different people will want different remotes; it would make no sense to do this.) See github.com/github/hub for GitHub integration in Git.
Jan 13, 2017 at 19:12 comment added UpAndAdam @Steckdoserich couldn't agree more. It is extremely sad that people here think that force pushing a publicly visible branch after a rebase is remotely correct or acceptable. It renders your fork almost useless to anyone following along....
Oct 17, 2016 at 13:20 comment added Jan Oelker Instead of the rebase command, i used the following: git merge --no-ff upstream/master This way your commits aren't on top anymore.
Aug 22, 2016 at 16:34 review Suggested edits
Aug 22, 2016 at 17:34
Jul 14, 2016 at 6:09 comment added Akshay Damle It'd probably be easier and faster if one simply deleted and re-forked.
Jun 3, 2016 at 23:37 history edited the Tin Man CC BY-SA 3.0
edited for readability and grammar and remove "Edit" and "Update".
Dec 4, 2015 at 12:09 comment added Mark Longair @crisron: good point - that's not really clear. The rebase will look at the change (patch) that was introduced by each commit in its original point in the history and try to apply that change on a different parent commit (keeping the same message and author information). Sometimes this won't apply cleanly, and you have to fix conflicts. So what I meant by your commits being "replayed on top of that other branch" is taking each of your new commits that aren't in that branch, and trying to recreate them, one-by-one, by making the same change as they did with respect to their original parent.
Nov 29, 2015 at 9:02 comment added crisron @MarkLongair what does "replayed on top of that other branch" mean here?
Feb 18, 2015 at 21:40 comment added dashesy this is better than github's help here which does not set up upstream.
May 10, 2014 at 3:36 comment added Alfred Xing If you want to have the original repo locally and still want to update your fork, you can add your fork as a downstream remote similar to above, then push to it: git push -f downstream.
Jan 12, 2014 at 2:37 comment added Pablo Olmos de Aguilera C. If you have local commits, doesn't this creates ugly "Merge branch 'master' of github.com:user/repo" commits every time you try to get the updates from the upstream? You can rebase sure, but if you pushed your changes to your forked repo on github, means next time you just can't rebase without regenerating the hashes for every commit after it turning everything in a mess. I really don't know how to properly "maintain" a fork on github.
Dec 31, 2013 at 11:04 comment added Mark Longair @episodeyang: I don't mind the example URL being changed from git:// to https://, but your comment at the end was wrong - the git protocol still works fine with GitHub; I suspect you were trying from a network that blocks traffic to port 9418, or something similar. I've removed that bit of your edit.
Dec 31, 2013 at 11:04 history edited Mark Longair CC BY-SA 3.0
Remove an incorrect update; the git protocol still works fine with GitHub
S Dec 31, 2013 at 7:08 history suggested episodeyang CC BY-SA 3.0
Tested the original solution on multiple Mac's, had consistent result. Only `https` works, not `git`, as with the original solution.
Dec 31, 2013 at 7:07 review Suggested edits
S Dec 31, 2013 at 7:08
Oct 16, 2013 at 8:06 comment added rubo77 After your changes are accepted in the upstream, you need to repeat these steps: git fetch upstream; git rebase upstream/master; git push origin master
Oct 16, 2013 at 7:17 review Suggested edits
Oct 16, 2013 at 7:19
May 29, 2013 at 23:09 comment added Mateusz Kowalczyk A quick note that rather than having to rebase your own master branch to ensure you are starting with clean state, you should probably work on a separate branch and make a pull request from that. This keeps your master clean for any future merges and it stops you from having to rewrite history with -f which messes up everyone that could have cloned your version.
Mar 19, 2013 at 13:42 comment added yeh @TimKeating Github does have web interface to deal with merges from others' pull request. I am wondering what will happen if i exchange the destination and my repo when sending a pull request.
Jun 19, 2012 at 3:50 comment added Tim Keating As your fork only exists on github, and github does not have tools for doing merges through the web interface, then the right answer is to do the upstream merge locally and push the changes back to your fork.
May 24, 2012 at 16:06 comment added todd.pierzina I +1'ed this answer because it probably accomplishes what the question author actually needed. But I'm in the same situation and am curious: is there any way to actually "pull" from the main repo into my fork? Or will the upstream fork only be updated if I push back up to it after fetching from upstream?
Aug 30, 2011 at 17:53 vote accept Lea Hayes
Aug 30, 2011 at 14:23 history edited Mark Longair CC BY-SA 3.0
added 290 characters in body
Aug 30, 2011 at 14:01 history answered Mark Longair CC BY-SA 3.0