Skip to content

Commit

Permalink
Updated Magit section
Browse files Browse the repository at this point in the history
* Moved files to drop the git prefix
git-status.md is now status.md
git-timemachine is now timemachine.md

* Added content for Remote repositories
Remote menu and basic description
Embedded a video of adding a remote Github repository (works the same for
Gitlab).

* Added content for Timemachine
Description of time machine, menu and basic usage.
Also added details on how to customise timemachine, although the defaults are
very good in my opinion.
  • Loading branch information
practicalli-johnny committed Oct 9, 2018
1 parent 1a0f2b1 commit 686916d
Show file tree
Hide file tree
Showing 15 changed files with 103 additions and 57 deletions.
11 changes: 6 additions & 5 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,16 @@
* [Snippets](documentation/snippets.md)
* [Testing](testing/index.md)
* [Run tests](testing/run-tests.md)
* [MaGit - Version Control](magit/index.md)
* [Create local repositry](magit/create-local-repository.md)
* [Git Status](magit/git-status.md)
* [MaGit Version Control](magit/index.md)
* [Create local repository](magit/create-local-repository.md)
* [Git Status](magit/status.md)
* [MaGit Status Fullscreen](magit/status-fullscreen.md)
* [Local commits](magit/local-commits.md)
* [Remote repositories](magit/remote-repositories.md)
* [Stashing changes](magit/stashing.md)
* [Changing History](magit/changing-history.md)
* [Rebasing](magit/rebasing.md)
* [Stashing changes](magit/remote-repositories.md)
* [Git Timemachine](magit/git-timemachine.md)
* [Timemachine](magit/timemachine.md)
* [Github](github/index.md)
* [Gists](github/gists.md)
* [Debugging](debugging/index.md)
Expand Down
Binary file added images/spacemacs-git-timemachine-customize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spacemacs-git-timemachine-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spacemacs-magit-remotes-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spacemacs-magit-status-example-full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 14 additions & 8 deletions magit/changing-history.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
# Changing History

> #### TODO::work in progress, sorry
The need to change history in Git should be minimal and should limited to fixing errors made in previous commits on your local repository.

Here are a few simple tools to help you change your local history.

> If you need to change history on a share repository, then think again, then think about how many people your history re-writing exercise is going to affect, then think about it again! If you really must change a shared git history, get consent from the people you will affect.
> Its much simpler to commit a new change that fixes the error and let others pull that in, or not make that mistake in the first place.
> #### Hint:: Consentual Shared Remote History rewriting
> If you need to change commit history on a share repository then think about how many people it is going to affect. If you really must change a shared git history, get consent from the people you will affect first.
>
> It is much simpler to commit a new change that fixes the omission or error and let others pull that additional change.

## Amend commit
## Amend commit

Really useful if you missed a change in the last commit, especially if that commit was recent. This creates a new commit with both the currently staged changes and the change in the previous commit.
This creates a new commit with both the currently staged changes and the change in the previous commit.

> The previous commit is no longer available through the normal git tools (although its still there as an object in your `.git` directory).
If you forgot to include some changes in the last commit, then this is a way to avoid two commits for the same logical change.

{% youtube %}
https://youtu.be/2NNrc61RVx4?autoplay=1loop=1
{% endyoutube %}


## Squash commits
## Squash commits

> Also see interactive rebasing
## Fixing up
## Fixing up
6 changes: 0 additions & 6 deletions magit/git-status.md

This file was deleted.

29 changes: 0 additions & 29 deletions magit/git-timemachine.md

This file was deleted.

2 changes: 2 additions & 0 deletions magit/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# MaGit - Version Control

> #### TODO::work in progress, sorry
Magit is a very powerful and simple to use client for Git version control.

Here is a quick demonstration of Magit in action where we stage and commit changes locally, then push those commits to [Github](https://github.com)
Expand Down
7 changes: 3 additions & 4 deletions magit/local-commits.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Local commits

> #### TODO::work in progress, sorry
## Staging


## Commit
## Staging


## Commit
10 changes: 6 additions & 4 deletions magit/rebasing.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Interactive Rebasing

Magit makes it easy to do interactive rebasing
> #### TODO::work in progress, sorry
Open the git log view with `l l` and select the point in history you want to rebase from
Magit makes it easy to do interactive rebasing

Open the git log view with `l l` and select the point in history you want to rebase from


## Fixing up

## Fixing up

## Squashing

## Squashing

Open th e
25 changes: 24 additions & 1 deletion magit/remote-repositories.md
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
# Stashing changes
# Working with Remote Repositories

`SPC g s` opens Magit Status (equivalent to git status)

`M` shows pop-up to work with remote repositories

[![Spacemacs Magit - Remotes menu](/images/spacemacs-magit-remotes-menu.png)](/images/spacemacs-magit-remotes-menu.png)


## Adding a remote repository

Open Magit status using `SPC g s`.

`M` opens the Remotes menu, showing a popup list of actions

`a` prompts for the remote name, e.g. origin, followed by a prompt for the URL of the repository, e.g. a github / gitlab address. The final prompt asks to set this new remote as the default, saying yes adds this to the `P` push menu.

{% youtube %}
https://www.youtube.com/embed/AdEOazt1rD0#t=3m50s?autoplay=1loop=1
{% endyoutube %}

> #### Hint:: Jump to 3 minutes 50 seconds
> Adding a remote repository starts at 3 minutes and 50 seconds into this video.
> I will add an edited version at some point.
2 changes: 2 additions & 0 deletions magit/stashing.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Stashing changes

> #### TODO::work in progress, sorry
10 changes: 10 additions & 0 deletions magit/status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Git Status

`SPC g s` runs Magit status, showing the changes you have in the git project the current buffer belongs too.

[![Spacemacs Magit Status Exaple](/images/spacemacs-magit-status-example-full.png)](/images/spacemacs-magit-status-example-full.png)



> #### Hint:: Creating a local git repository
> If you open magit status on a file that is not in version control, magit will prompt you to create a git repository. See [creating a local repository](create-a-local-repository.html)
36 changes: 36 additions & 0 deletions magit/timemachine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Git Timemachine

Easily navigate backwards and forwards throught the commit history of a file under Git Version Control. The buffer shows the file as it was in each change you select.

> #### Hint:: Positioning the buffer content
> Timemachine seems to work best when you have all the text visible in a buffer or you roughly know where the changes are in the file as you move between commits.
## Using Timemachine

`SPC g t` opens the Git Timemachine transient state.

[![Spacemacs Git Timemachine Menu](/images/spacemacs-git-timemachine-menu.png)](/images/spacemacs-git-timemachine-menu.png)

Use the following keys to navigate through all the commits for the current file

| Keybinding | Description |
|------------|-------------------------------------------------|
| `c` | Show the most recent commit for the file |
| `g` | Go to nth commit |
| `p` | Show previous commit |
| `n` | Show next commit |
| `t` | Go to revision by selected commit message |
| `w` | Copy the abbreviated hash of the current commit |
| `W` | Copy the full hash of the current commit |
| `q` | Exit Timemachine transient state |


> #### INFO:: Magit blame
> According to the git-timemachine website, `b` runs `magit-blame` on the currently visited revision. This keybinding is not part of the git layer in Spacemacs.
> As the minibuffer already shows author information, it seems redundant to add this option.
## Customise Timemachine

`SPC SPC customize [git-timemachine]`.

[![Spacemacs Git Timemachine - Customize](/images/spacemacs-git-timemachine-customize.png)](/images/spacemacs-git-timemachine-customize.png)

0 comments on commit 686916d

Please sign in to comment.