# How to revert dirty packages

**URL:** <https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122>\
**Category:** General Usage\
**Tags:** package\
**Created:** [February 15, 2017, 5:53pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122 "2017-02-15T17:53:49Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![pitao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pitao/32/116_2.png) [@pitao](https://discourse.julialang.org/u/pitao)\
**Post date:** [February 15, 2017, 5:53pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/1 "2017-02-15T17:53:49Z")

</div>

My `Pkg.status()` is:

```julia
julia> Pkg.status()
1 required packages:
 - Atom 0.5.9+ master
45 additional packages:
 - ASTInterpreter 0.0.4+ master
 :
 - HttpCommon 0.2.6
 - HttpParser 0.2.0+ master (dirty)
 - HttpServer 0.1.7
 - JSON 0.8.3
 - JuliaParser 0.7.4+ master
 - Juno 0.2.6 master (dirty)
 - LNR 0.0.2+ master

```

I put in a couple of debug print statements & two repos are now dirty.

Problem is that `Pkg.update()` now avoids updating them.

How can I fix this? I don’t wish to preserve my changes?

I’ve been offered instructions such as `git reset --hard head` but nothing is shifting it.

(I’m on OSX)

---

<div class="post-metadata">

**Author:** ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Post date:** [February 15, 2017, 6:18pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/2 "2017-02-15T18:18:35Z")

</div>

1. In the long run you need to learn git.
2. dirty means, the package manager detects a difference to the assumed checkout/commit → one or more modified files (git status should tell you).
3. revisiting 1)  
[Git - Undoing Things](https://git-scm.com/book/en/v2/Git-Basics-Undoing-Things)  
your case is: Unmodifying a Modified File

---

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [February 15, 2017, 7:24pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/3 "2017-02-15T19:24:01Z")

</div>

You could try removing and then re-installing the dirty package:

```julia
Pkg.rm("...")
Pkg.add("...")

```

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [February 15, 2017, 7:25pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/4 "2017-02-15T19:25:13Z")

</div>

I think you’re supposed to create branches more often. Presumably because it’s it easier to switch between branches than move forward and backward through commits. Of course this isn’t helpful now…

A lot of people may find Git easy. but I’m not one of them. By far the hardest aspect of contributing to Julia is the Git(Hub) side of things, in my experience.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 15, 2017, 7:39pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/5 "2017-02-15T19:39:01Z")

</div>

1. Open up [GitKraken](https://www.gitkraken.com/)
2. Open up the repo
3. Double click on the remote master branch. It’s the `master` with the Github local next to it. It will ask if you want to overwrite your local master. Click yes.
4. Go back to 2. Do for all repos.

I don’t know of an easier way to git than to use GitKraken. If I had to use the command line, I would do this by `cd`’ing into the repos and just doing `git stash`. It’s not the same (it saves the changes to the stash), but it’s not very different.

---

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [February 15, 2017, 7:51pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/6 "2017-02-15T19:51:05Z")

</div>

@cormullion I was in your same situation, and this tutorial helped me out: [Setting up a repository | Atlassian Git Tutorial](https://www.atlassian.com/git/tutorials/setting-up-a-repository).  
I came to realize that for minor contributions, git is not painfully complicated. You may also find [GitHub Desktop](https://desktop.github.com/) a useful tool.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [February 15, 2017, 7:59pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/7 "2017-02-15T19:59:49Z")

</div>

Thanks! Although, I’ve seen quite a few videos and read through a few ebooks. The problem for me is not basic Git, but how to match up the development models in the example documents with the actual working development model used in Julia.

For example, I can probably understand [this](http://nvie.com/posts/a-successful-git-branching-model/). But seeing the connections and differences with the Julia/GitHub model is the challenge.

---

<div class="post-metadata">

**Author:** ![johnmyleswhite](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnmyleswhite/32/31_2.png) [@johnmyleswhite](https://discourse.julialang.org/u/johnmyleswhite)\
**Post date:** [February 15, 2017, 8:33pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/8 "2017-02-15T20:33:02Z")

</div>

AFAIK, the Julia development is far, far simpler than that post. All core development happens on the master branch, which is periodically split off into releases branches for old releases and those branches are quasi-dead since they’re only updated for bug fixes.

Individual contributors with commit access create branches on GitHub when they want to show people their code, but those branches are just individuals’ development work and could easily live in forked repos if people were willing to put up with more tedium. People without commit access have to use forks and then provide PR’s because they, by definition, can’t change the main repo’s state without a PR.

Unless I’m missing something, that’s all there is to it. Even Google seems to use a similarly simple approach: [[1702.01715] Software Engineering at Google](https://arxiv.org/abs/1702.01715)

In case that description is too complicated, here’s an even simpler version:

- The official living codebase is master. To get new code into master, you have to submit a PR and get it reviewed.

- The quasi-dead codebase for historical releases is on a set of release branches. Almost no contributors should ever be changing code on release branches and their existence is effectively irrelevant to normal people.

- Individuals’ work happens on any other branch that’s not master or a release branch. You use a separate branch because you want to be free to do anything you want without review.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 15, 2017, 9:52pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/9 "2017-02-15T21:52:33Z")

</div>

@johnmyleswhite 's description is dead-on.

> [@mzaffalon](#):
>
> You may also find GitHub Desktop a useful tool.

Because @johnmyleswhite 's description is dead-on, I would advise against this. I used it for awhile, but it doesn’t handle multiple remotes well. Most likely, you will need two remotes, since one remote will be to the branch you are working on (on your fork), and the other will be the master branch in the original repo. Github Desktop doesn’t handle this well, so I had troubles when using it and it was easier to just use the CLI.

Other GUIs, (like what I recommended, GitKraken) can handle multiple remotes. If you don’t care about being hardcore and would prefer to just drag your branch over “master” and have it open a PR, it’s very nice.

---

<div class="post-metadata">

**Author:** ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Post date:** [February 16, 2017, 11:49am UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/10 "2017-02-16T11:49:53Z")

</div>

If i read here about the benefits of single stream development i still wonder why we allow us the luxury of independent package repositories? We could in the first step limit to 1 repo per organisation.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 16, 2017, 8:23pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/11 "2017-02-16T20:23:13Z")

</div>

> [@lobingera](#):
>
> If i read here about the benefits of single stream development i still wonder why we allow us the luxury of independent package repositories? We could in the first step limit to 1 repo per organisation.

From Google’s report:

> As of January 2015, this 86 terabyte repository contained a billion files

Many packages will be used as small embedded codes. I get a lot questions pertaining how to use specific parts of the ODE solvers, which is why DifferentialEquations.jl split apart so that way you could have a “low-dependency mode”. Since you download the full repository in Julia, throwing these huge repos at the user is just not user-friendly.

Besides, it goes against encapsulation of toolkits. Google gets to be different because they deploy everything to their giant webservers. We give it to individual user’s computers. If someone wants a small utility library for handling X, why do they need the entirety of JuliaDiffEq/JuliaOpt/JuliaStats just because that’s the org that made it? For a huge webserver, it has to be there anyways, so why not. But we’re developing for a different regime.

---

<div class="post-metadata">

**Author:** ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Post date:** [February 17, 2017, 9:45am UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/12 "2017-02-17T09:45:14Z")

</div>

> [@ChrisRackauckas](#):
>
> Since you download the full repository in Julia,

maybe that’s already not user friendly (yes, i know Pkg3 will be here in a second…).

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [February 17, 2017, 6:44pm UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/13 "2017-02-17T18:44:03Z")

</div>

It would be nice if there were a `Pkg.reset("Foo")` function or similar that did the equivalent of `git reset --hard`. (Would be easy to implement since libgit2 supports this functionality.)

Often, when I’m testing a package out on some test machine, I make experimental changes to a package to help debug problems. However, I don’t have `git` installed on that machine, and it is a pain to have to download `git` just to reset the package directory to a clean state.

---

<div class="post-metadata">

**Author:** ![YongHee-Kim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yonghee-kim/32/5965_2.png) [@YongHee-Kim](https://discourse.julialang.org/u/YongHee-Kim)\
**Post date:** [July 5, 2018, 4:09am UTC](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122/14 "2018-07-05T04:09:53Z")

</div>

It’s an old topic, but still comes at top of [goole search](https://www.google.co.kr/search?q=julia+package+dirty&oq=julia+package+dirty&aqs=chrome..69i57j69i60l3j69i64l2.2462j0j4&sourceid=chrome&ie=UTF-8)  
This is a tip for reverting dirty package for vscode users.

1. Open dirty package directory from command pallet - press `F1` and `Julia Open Package Dir...`  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/4/b4f9962ad5d15a63e087a38eb8fbfd3f4f500f20.png)

2. Discard all Changes from the sidebar  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/0/20cbedf95f6e4831d30653bd52b15c33517d3423.png)
