-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Clone A Repo Just For The Files, Without History | ||
|
||
Though the history of a Git repository is a huge part of its value, sometimes | ||
you just want a copy of the files for the current state of the main branch. | ||
|
||
Using the `--depth` flag with `git-clone` allows you to clone a repo without | ||
its history. You can do that with a depth of `1` which will clone the top of | ||
the tree and exclude all the past history. | ||
|
||
```bash | ||
$ git clone --depth 1 git@github.com:jbranchaud/til.git | ||
``` | ||
|
||
If you do a `git log` after this, you'll see there is only one commit in the | ||
history. Depending on the size and history of the repo, you may notice that the | ||
clone is quicker than one that includes the full history. | ||
|
||
See `man git-clone` for more details. | ||
|
||
[Copied](https://github.com/jbranchaud/til/blob/master/git/clone-a-repo-just-for-the-files-without-history.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Update The URL Of A Remote | ||
|
||
I just changed the name of a Github repository. One of the implications of | ||
this is that the remote URL that my local git repository has on record is | ||
now out of date. I need to update it. | ||
|
||
If I use `git-remote` with the `-v` flag. I can see what remotes I currently | ||
have. | ||
|
||
```bash | ||
$ git remote -v | ||
origin git@github.com:jbranchaud/pokemon.git (fetch) | ||
origin git@github.com:jbranchaud/pokemon.git (push) | ||
``` | ||
|
||
Now, to update the URL for that remote, I can use `git remote set-url` | ||
specifying the name of the remote and the updated URL. | ||
|
||
```bash | ||
$ git remote set-url origin git@github.com:jbranchaud/pokemon_deluxe.git | ||
``` | ||
|
||
If I check again, I can see it has been updated accordingly. | ||
|
||
```bash | ||
$ git remote -v | ||
origin git@github.com:jbranchaud/pokemon_deluxe.git (fetch) | ||
origin git@github.com:jbranchaud/pokemon_deluxe.git (push) | ||
``` |