diff --git a/SUMMARY.md b/SUMMARY.md index edb945768..f024bfee7 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -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) diff --git a/images/spacemacs-git-timemachine-customize.png b/images/spacemacs-git-timemachine-customize.png new file mode 100644 index 000000000..8715ea43f Binary files /dev/null and b/images/spacemacs-git-timemachine-customize.png differ diff --git a/images/spacemacs-git-timemachine-menu.png b/images/spacemacs-git-timemachine-menu.png new file mode 100644 index 000000000..2377012f1 Binary files /dev/null and b/images/spacemacs-git-timemachine-menu.png differ diff --git a/images/spacemacs-magit-remotes-menu.png b/images/spacemacs-magit-remotes-menu.png new file mode 100644 index 000000000..d7e65674a Binary files /dev/null and b/images/spacemacs-magit-remotes-menu.png differ diff --git a/images/spacemacs-magit-status-example-full.png b/images/spacemacs-magit-status-example-full.png new file mode 100644 index 000000000..c8048b44b Binary files /dev/null and b/images/spacemacs-magit-status-example-full.png differ diff --git a/magit/changing-history.md b/magit/changing-history.md index 5bb7cc2da..f8c435adc 100644 --- a/magit/changing-history.md +++ b/magit/changing-history.md @@ -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 diff --git a/magit/git-status.md b/magit/git-status.md deleted file mode 100644 index 38dc14d78..000000000 --- a/magit/git-status.md +++ /dev/null @@ -1,6 +0,0 @@ -# Git Status - -Git status will show you the changes you have in the git project the current buffer belongs too. - -> **Hint** 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) - diff --git a/magit/git-timemachine.md b/magit/git-timemachine.md deleted file mode 100644 index 66827711a..000000000 --- a/magit/git-timemachine.md +++ /dev/null @@ -1,29 +0,0 @@ -# Git Timemachine - -Easily navigate backwards and forwards throught the change history of a file, seeing changes in the file as you move between commits. - -> **Hint** 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 - -You can use Git Timemachine with any buffer that holds a file in Git version control. When you enable timemachine in the buffer, editing is disabled, so you can use the simple keybindings in this mode (detailed below) - -Visit a git-controlled file and run the command `M-x git-timemachine` (or bind it to a keybinding such as C-o g t t). Alternatively, toggle the time machine you can use `M-x git-timemachine-toggle`. - -Use the following keys to navigate historic version of the file - - `p` Visit previous historic version - - `n` Visit next historic version - - `w` Copy the abbreviated hash of the current historic version - - `W` Copy the full hash of the current historic version - - `g` Goto nth revision - - `q` Exit the time machine. - -## Customize - -> **Fixme** work in progress - add how to set these configuration options in Spacemacs - -Set `git-timemachine-abbreviation-length` (default 12) to your preferred length for abbreviated commit hashes. - -Set `git-timemachine-show-minibuffer-details` (default t) to control whether details of the commit are shown in the minibuffer. - -Also `M-x customize [git-timemachine]`. diff --git a/magit/index.md b/magit/index.md index b5bc9ef77..21c0d013d 100644 --- a/magit/index.md +++ b/magit/index.md @@ -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) diff --git a/magit/local-commits.md b/magit/local-commits.md index 69056a92e..a9103fd33 100644 --- a/magit/local-commits.md +++ b/magit/local-commits.md @@ -1,9 +1,8 @@ # Local commits +> #### TODO::work in progress, sorry -## Staging - - -## Commit +## Staging +## Commit diff --git a/magit/rebasing.md b/magit/rebasing.md index fcccc5a9d..9a5226157 100644 --- a/magit/rebasing.md +++ b/magit/rebasing.md @@ -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 diff --git a/magit/remote-repositories.md b/magit/remote-repositories.md index 756bdcb88..76a8ebc16 100644 --- a/magit/remote-repositories.md +++ b/magit/remote-repositories.md @@ -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. diff --git a/magit/stashing.md b/magit/stashing.md index 756bdcb88..b957562d7 100644 --- a/magit/stashing.md +++ b/magit/stashing.md @@ -1 +1,3 @@ # Stashing changes + +> #### TODO::work in progress, sorry diff --git a/magit/status.md b/magit/status.md new file mode 100644 index 000000000..b0e2456ee --- /dev/null +++ b/magit/status.md @@ -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) diff --git a/magit/timemachine.md b/magit/timemachine.md new file mode 100644 index 000000000..554ee33ed --- /dev/null +++ b/magit/timemachine.md @@ -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)