diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -43,12 +43,13 @@
 * [Update](#update): updates one or all packages in `nix/sources.json`.
 * [Drop](#drop): deletes a package from `nix/sources.json`.
 
-`niv` has two more utility functions:
+`niv` has some utility functions:
 
 * [Init](#init): bootstraps a Nix project, in particular creates a
   `nix/sources.json` file containing `niv` and `nixpkgs` as well as a
   `nix/sources.nix` file that returns the sources as a Nix object.
 * [Show](#show): shows the packages' information.
+* [Modify](#modify): modifies attributes _without_ performing an update.
 
 ### Configuration
 
@@ -203,7 +204,7 @@
 ```
 niv - dependency manager for Nix projects
 
-version: 0.2.12
+version: 0.2.13
 
 Usage: niv [-s|--sources-file FILE] COMMAND
 
@@ -217,7 +218,8 @@
   add                      Add a GitHub dependency
   show                     
   update                   Update dependencies
-  modify                   Modify dependency
+  modify                   Modify dependency attributes without performing an
+                           update
   drop                     Drop dependency
 
 ```
@@ -276,6 +278,39 @@
   Update dependencies
 
 Available options:
+  -a,--attribute KEY=VAL   Set the package spec attribute <KEY> to <VAL>, where
+                           <VAL> may be JSON.
+  -s,--string-attribute KEY=VAL
+                           Set the package spec attribute <KEY> to <VAL>.
+  -b,--branch BRANCH       Equivalent to --attribute branch=<BRANCH>
+  -o,--owner OWNER         Equivalent to --attribute owner=<OWNER>
+  -r,--repo REPO           Equivalent to --attribute repo=<REPO>
+  -v,--version VERSION     Equivalent to --attribute version=<VERSION>
+  -t,--template URL        Used during 'update' when building URL. Occurrences
+                           of <foo> are replaced with attribute 'foo'.
+  -T,--type TYPE           The type of the URL target. The value can be either
+                           'file' or 'tarball'. If not set, the value is
+                           inferred from the suffix of the URL.
+  -h,--help                Show this help text
+
+```
+
+#### Modify
+
+```
+Examples:
+
+  niv modify nixpkgs -v beta-0.2
+  niv modify nixpkgs -a branch=nixpkgs-unstable
+
+Usage: niv modify PACKAGE [-n|--name NAME] ([-a|--attribute KEY=VAL] |
+                  [-s|--string-attribute KEY=VAL] | [-b|--branch BRANCH] |
+                  [-o|--owner OWNER] | [-r|--repo REPO] | [-v|--version VERSION]
+                  | [-t|--template URL] | [-T|--type TYPE])
+  Modify dependency attributes without performing an update
+
+Available options:
+  -n,--name NAME           Set the package name to <NAME>
   -a,--attribute KEY=VAL   Set the package spec attribute <KEY> to <VAL>, where
                            <VAL> may be JSON.
   -s,--string-attribute KEY=VAL
diff --git a/niv.cabal b/niv.cabal
--- a/niv.cabal
+++ b/niv.cabal
@@ -4,10 +4,10 @@
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: 2bd705c1e78363bb062880212f798145d4fb15e51d7324e15c95327ba9632d35
+-- hash: a1d6256f329a5a130dcb0d8cbcbef0144451cc06f2ac5e70034bf3ed419b8914
 
 name:           niv
-version:        0.2.12
+version:        0.2.13
 synopsis:       Easy dependency management for Nix projects
 description:    Easy dependency management for Nix projects.
 category:       Development
@@ -107,7 +107,8 @@
     , unordered-containers
   default-language: Haskell2010
 
-executable niv-test
+test-suite unit
+  type: exitcode-stdio-1.0
   main-is: NivTest.hs
   other-modules:
       Niv
diff --git a/src/Niv/Cli.hs b/src/Niv/Cli.hs
--- a/src/Niv/Cli.hs
+++ b/src/Niv/Cli.hs
@@ -394,21 +394,27 @@
 parseCmdModify :: Opts.ParserInfo (NIO ())
 parseCmdModify =
     Opts.info
-      ((cmdModify <$> parsePackage) <**> Opts.helper) $
+      ((cmdModify <$> parsePackageName <*> optName <*> parsePackageSpec githubCmd) <**> Opts.helper) $
       mconcat desc
   where
     desc =
       [ Opts.fullDesc
-      , Opts.progDesc "Modify dependency"
+      , Opts.progDesc "Modify dependency attributes without performing an update"
       , Opts.headerDoc $ Just $
           "Examples:" Opts.<$$>
           "" Opts.<$$>
           "  niv modify nixpkgs -v beta-0.2" Opts.<$$>
           "  niv modify nixpkgs -a branch=nixpkgs-unstable"
       ]
+    optName = Opts.optional $ PackageName <$> Opts.strOption
+      ( Opts.long "name" <>
+        Opts.short 'n' <>
+        Opts.metavar "NAME" <>
+        Opts.help "Set the package name to <NAME>"
+      )
 
-cmdModify :: (PackageName, PackageSpec) -> NIO ()
-cmdModify (packageName, cliSpec) = do
+cmdModify :: PackageName -> Maybe PackageName -> PackageSpec -> NIO ()
+cmdModify packageName mNewName cliSpec = do
     tsay $ "Modifying package: " <> unPackageName packageName
     fsj <- getFindSourcesJson
     sources <- unSources <$> li (getSources fsj)
@@ -417,7 +423,13 @@
       Just defaultSpec -> pure $ attrsToSpec (specToLockedAttrs cliSpec <> specToFreeAttrs defaultSpec)
       Nothing -> li $ abortCannotModifyNoSuchPackage packageName
 
-    li $ setSources fsj $ Sources $ HMS.insert packageName finalSpec sources
+    case mNewName of
+      Just newName -> do
+        when (HMS.member newName sources) $
+          li $ abortCannotAddPackageExists newName
+        li $ setSources fsj $ Sources $ HMS.insert newName finalSpec $ HMS.delete packageName sources
+      Nothing ->
+        li $ setSources fsj $ Sources $ HMS.insert packageName finalSpec sources
 
 -------------------------------------------------------------------------------
 -- DROP
diff --git a/src/Niv/GitHub/Cmd.hs b/src/Niv/GitHub/Cmd.hs
--- a/src/Niv/GitHub/Cmd.hs
+++ b/src/Niv/GitHub/Cmd.hs
@@ -10,6 +10,7 @@
 import Control.Applicative
 import Data.Aeson ((.=))
 import Data.Bifunctor
+import Data.Char (isAlphaNum)
 import Data.Maybe
 import Data.String.QQ (s)
 import Data.Text.Extended
@@ -133,14 +134,21 @@
 githubUpdate' = githubUpdate nixPrefetchURL githubLatestRev githubRepo
 
 nixPrefetchURL :: Bool -> T.Text -> IO T.Text
-nixPrefetchURL unpack (T.unpack -> url) = do
+nixPrefetchURL unpack turl@(T.unpack -> url) = do
     (exitCode, sout, serr) <- runNixPrefetch
     case (exitCode, lines sout) of
       (ExitSuccess, l:_)  -> pure $ T.pack l
       _ -> abortNixPrefetchExpectedOutput (T.pack sout) (T.pack serr)
   where
-    args = if unpack then ["--unpack", url] else [url]
+    args = (if unpack then ["--unpack"] else []) <> [ url, "--name", sanitizeName basename]
     runNixPrefetch = readProcessWithExitCode "nix-prefetch-url" args ""
+    sanitizeName = T.unpack . T.filter isOk
+    basename = last $ T.splitOn "/" turl
+    -- From the nix-prefetch-url documentation:
+    --  Path names are alphanumeric and can include the symbols +-._?= and must
+    --  not begin with a period.
+    -- (note: we assume they don't begin with a period)
+    isOk = \c -> isAlphaNum c || T.any (c ==) "+-._?="
 
 abortNixPrefetchExpectedOutput :: T.Text -> T.Text -> IO a
 abortNixPrefetchExpectedOutput sout serr = abort $ [s|
