# Julia-git workflow, newbie questions

**URL:** <https://discourse.julialang.org/t/julia-git-workflow-newbie-questions/6125>\
**Category:** Tooling\
**Created:** [September 27, 2017, 9:59pm UTC](https://discourse.julialang.org/t/julia-git-workflow-newbie-questions/6125 "2017-09-27T21:59:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Gibson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/john_gibson/32/5321_2.png) [@John\_Gibson](https://discourse.julialang.org/u/John_Gibson)\
**Post date:** [September 27, 2017, 9:59pm UTC](https://discourse.julialang.org/t/julia-git-workflow-newbie-questions/6125/1 "2017-09-27T21:59:31Z")

</div>

I’ve made a few small changes to julia/test/perf/micro to get them running on 0.7.0. I’d like to make a pull request for them, but I can’t figure out the proper git workflow from the docs.

So far I’ve followed directions from [CONTRIBUTING.md](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md)

- have forked [github.com/julia](http://github.com/julia) to [github.com/johnfgibson/julia](http://github.com/johnfgibson/julia)
- have cloned the fork to a local machine
- switched local clone to branch `perf-micro-update`
- made changes, got the benchmarks running
- did a git add, git commit, and `git push origin perf-micro-update` to push the changes to my github fork

But now my github fork is 92 commits behind master, and I can’t figure out how to merge those into my work, local or github, in order to make a clean pull request.

The [Patrick O’Leary Julia-Github video](https://www.youtube.com/watch?v=wnFYV3ZKtOg&feature=youtu.be) and [accompanying notes](https://gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2Fdmbates%2F2712118#file_Julia_git_pull_request.md) give a beautiful explanation what to do, but directly between a local clone and [github.com/julia](http://github.com/julia), without the intervening fork of julia to one’s personal github account. But that fork is recommended by [CONTRIBUTING.md](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md). I don’t get the reason for the fork or how to adapt the O’Leary instructions to deal with it.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [September 27, 2017, 10:39pm UTC](https://discourse.julialang.org/t/julia-git-workflow-newbie-questions/6125/2 "2017-09-27T22:39:41Z")

</div>

Option 1 is: do nothing at all. Your branch need not be based on the very latest `master` to have a clean pull request, as long as you and `master` have not both modified the same lines. You can just open a pull request right now, and github will tell you if it can be merged cleanly (I just checked, and your particular branch can).

But beyond that, I think you may have misread the notes you linked (or maybe the video is different?). The notes do actually specify the workflow using a github fork of julialang/julia:

> After creating a fork of the julia repository under your own github account, add the repository  
> `git remote add mine git@github.com:dmbates/julia.git`

In fact, there’s really no way to submit a PR through github without making a fork first, so this is a necessary step.

But you’ve gone a bit off-script by cloning your fork, rather than cloning julialang/julia and adding your fork as a new remote (as the notes suggest). Fortunately, that’s not a problem. You (probably) currently have:

```julia
$ git remote -v   
origin	git@github.com:johnfgibson/julia.git (fetch)
origin	git@github.com:johnfgibson/julia.git (push)

```

You need to tell `git` about the upstream repo. You can create a new remote with the name `upstream` like this:

```julia
git remote add upstream https://github.com/julialang/julia

```

And then you can get the commits from upstream with:

```julia
git fetch upstream

```

And you can merge the upstream master changes into your work with:

```julia
git checkout perf-micro-update
git merge upstream/master

```

and push your changes to your fork with

```julia
git push origin perf-micro-update

```

Or you can rebase (if you know what this is and care about linear commit history. Don’t do this unless you have specific reason to. ):

```julia
git checkout perf-micro-update
git rebase upstream/master

```

---

<div class="post-metadata">

**Author:** ![John\_Gibson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/john_gibson/32/5321_2.png) [@John\_Gibson](https://discourse.julialang.org/u/John_Gibson)\
**Post date:** [September 27, 2017, 11:05pm UTC](https://discourse.julialang.org/t/julia-git-workflow-newbie-questions/6125/3 "2017-09-27T23:05:10Z")

</div>

Great, thanks! I see that I did go off-script in cloning from my github fork. I think I was interpolating expectations from subversion experience into the CONTRIBUTING.md instructions.
