What is the process for getting updates from GitHub?

A bit of a newbie question here, not much a programmer and I was wondering how the updating process goes.

When new source code is released do we just download it into a new fork/repository from Github and then rebuild that with the required dependencies?
Or do the required dependencies get updated as well and updating will require starting from square 1?

And can we over-write older versions of the source code repositories (that we haven’t made changes to), so we don’t have needless clutter?

I checked the FAQ but couldn’t see anything about an updating process. Will updating UE4 while working on a bigger project still maintain it, for safety I don’t think I would update from a working version on a major project but just in case there’s a vital bug fix it might be worth it.

Thanks.

The update process will be different depending on how you acquired the UnrealEngine repository.

##Direct clone

If you cloned directly from EpicGames/UnrealEngine, you can simply update by pulling the latest commits:

git pull

And then checking out the version tag you’re interested in:

git checkout 4.1

##Fork

If you forked, you will have a remote branch named origin which points to the version of your repository as it currently exists on the GitHub servers. Note, however, that your fork is disconnected from Epic’s version of the repository – we need to remedy that.

If you have not already done so, define a new remote branch pointing to Epic’s UnrealEngine repo:

git remote add upstream https://github.com/EpicGames/UnrealEngine.git

Now fetch the most up-to-date data from the upstream branch:

git fetch upstream

Once that completes, you’re ready to merge in whichever version of the upstream branch that you want. To merge in the latest version 4.1 changes:

git merge upstream/4.1

If any conflicts were encountered while merging, resolve them:

git mergetool

You then need to commit the new changes:

git commit -m "Updated to version 4.1"

For more on working with forks, please refer to GitHub’s documentation: Fork a repo - GitHub Docs

##Required binaries

Required dependencies do not get updated automatically when you pull the latest changes from GitHub. It is likely that these zip files will change between releases, so you will need to manually download the latest versions and re-extract them into your local workspace.

You may safely overwrite old source repos, but in practice you shouldn’t have to. When you pull the latest changes from GitHub, all local source code will be updated to the most recent version. The simplest workflow is to work from a single repo clone and do all updating in-place. You shouldn’t need to generate multiple copies of your cloned repos unless you have a compelling reason to do so.

Given the manual nature of required binary zip files, you may accumulate some clutter in folders not governed by the repository (such as those created during zip file extraction), but it shouldn’t be a major concern. We are hoping to improve this part of the process in the future.

Incorrect, this does not work. Trying to update from 4.0.2 to 4.1, it tells me I’m already up to date.

Updated my answer with better instructions.

I used “git merge upstream/4.3” for the latest 4.3 version but got the following:

error: The following untracked working tree files would be overwritten by merge:

which listed some third party files and aborted the merge so I can’t use “git mergetool” as the merge has already aborted; how should I go about safely merging the files without it aborting?

I’m voting this up because its a very important topic and its probably worth getting more documentation on it. I’ve been using the fork/ fetch upstream method and was having problems. I just deleted UE4 from my hard drive and recloned 4.3- there’s now several gigs worth less data in the UnrealEngine folder than there was before. Methinks cloning straight from Epic may be less troublesome…

Furinyx, if they are third party files, are you sure you want to add them to the repository? You could always add them to the .gitignore file which would bypass the problem.

I re-forked for going from 4.0 to 4.1 and 4.1 to 4.2 but I am now planning to do serious projects with UE4 and want to be able to make engine changes with source control so just using cloning from Epic isn’t an option.

Luckily I haven’t changed anything yet so I deleted the local repository, re-cloned 4.2 freshly without dependencies and merged with upstream/4.3 which has conflicts as expected; however, when I use “git mergetool” it constantly comes up with “merge failed” and then “Continue merging other unresolved paths ?” and does not merge correctly, leaving conflicts, so I have had to go with re-forking once again to get 4.3 properly.

Hopefully this issue is addressed before 4.4 is out; I’m surprised the correct method isn’t documented on the Unreal Engine Github page.

Third Party was already on .gitignore but I’m guessing I needed more explicit ignores in place to bypass it, I will make sure to try that next time.
I detailed what I did this time in reply to robbie below.

Isn’t it better to make a new branch from the ‘promoted’ branch and use that as the main branch to work from and not the 4.X?

I also read that it’s best to fetch and then merge rather than just pull because that process should be done locally especially if it would be a large pull. Pull does both fetch and merge but right away as it’s being sucked in or right after and you don’t have any control over it.

So on ‘local’ and ‘origin’ there would be ‘promoted’ and ‘MYpromoted’ branches.
Checkout local ‘promoted’, fetch from upstream (EpicGames) for ‘promoted’ and merge to local ‘promoted’ then merge that with local ‘MYpromoted’ then push to origin (GitHub). Get that all in sync with no commits needed and then build because the build does lots of stuff. Just after build resync everything again. I think this is the cause of many of the git merging problems. It would be cool if a pro could comment on this and suggest some tips.

I also highly recommend SourceTree rather than just the terminal or GitHubs’ Windows app. It’s far better to understand what is going on and how to do things and things that can’t be done with the app it has a terminal ready to use for all the crazy git commands.

This worked great except that my upstream had to be set to
git@github.com:EpicGames/UnrealEngine.git

this avoided git from having to prompt for a password.

I think once u setup a user for git it works just fine with the github safe links