Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modern update for 2015 and beyond #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
**/output/
tiddlers/\$__StoryList.tid
359 changes: 359 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Git Fix Um

On undoing, fixing, or removing commits in git

## Contributing

1. Clone this repo.
2. `npm install`
3. `npm start`
4. Edit in browser
5. Submit a pull request

This starts the TiddlyWiki server. Open `http://localhost:8080` in your browser
and make edits. They are saved automatically to the repo so you can easily
`git add`/`git commit` them.

## Building

To build the stand alone HTML for publication run `npm run build` and it will
output `wiki-dist/output/index.html`.
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "git-fix-um",
"version": "1.0.0",
"description": "On undoing, fixing, or removing commits or mistakes in git ",
"private": true,
"scripts": {
"start": "tiddlywiki wiki --server",
"build": "tiddlywiki wiki-dist --rendertiddler '$:/core/save/all' index.html text/plain"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SethRobertson/GitFixUm.git"
},
"author": "Devin Weaver <[email protected]> (http://tritarget.org/)",
"license": "CC BY-SA 3.0",
"bugs": {
"url": "https://github.com/SethRobertson/GitFixUm/issues"
},
"homepage": "http://sethrobertson.github.io/GitFixUm/fixup.html",
"devDependencies": {
"tiddlywiki": "^5.1.8"
}
}
7 changes: 7 additions & 0 deletions tiddlers/$__DefaultTiddlers.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
created: 20150605123544055
modified: 20150606052319109
title: $:/DefaultTiddlers
type: text/vnd.tiddlywiki

[[First step]]
[[Are you trying to find that which is lost or fix a change that was made?]]
6 changes: 6 additions & 0 deletions tiddlers/$__SiteSubtitle.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
created: 20150605123511650
modified: 20150605123528911
title: $:/SiteSubtitle
type: text/vnd.tiddlywiki

On undoing, fixing, or removing commits in git
6 changes: 6 additions & 0 deletions tiddlers/$__SiteTitle.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
created: 20150605123453728
modified: 20150606051058239
title: $:/SiteTitle
type: text/vnd.tiddlywiki

Git Fix Um
6 changes: 6 additions & 0 deletions tiddlers/$__config_DefaultSidebarTab.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
created: 20150606145603553
modified: 20150606055212755
title: $:/config/DefaultSidebarTab
type: text/vnd.tiddlywiki

TableOfContents
7 changes: 7 additions & 0 deletions tiddlers/$__data_BranchName.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
branch: master
created: 20150606022747695
modified: 20150606044711776
tags:
title: $:/data/BranchName
type: text/vnd.tiddlywiki

13 changes: 13 additions & 0 deletions tiddlers/About.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
created: 20150606134230380
modified: 20150606140243740
tags: TableOfContents
title: About
type: text/vnd.tiddlywiki

This material was compiled and maintained by [[Seth Robertson]] and converted to this [[TiddlyWiki|http://tiddlywiki.com/]] format by [[Devin Weaver]].

~TiddlyWiki is a wiki based HTML5 application. Each card is called a tiddler.

!! Navigating between open tiddlers

{{Navigating between open tiddlers}}
9 changes: 9 additions & 0 deletions tiddlers/Answers.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
color: #0080ff
created: 20150605210829987
icon: $:/core/images/tip
modified: 20150606055314970
tags: TableOfContents
title: Answers
type: text/vnd.tiddlywiki

<<list-links filter:"[tag[Answers]] +[nsort[order]]">>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
created: 20150606033828302
modified: 20150606055503785
tags: Answers
title: Arbitrarily changing all commits during all of git's history
type: text/vnd.tiddlywiki

`git filter-branch` is a powerful, complex command that allows you to perform arbitary scriptable operations on all commits in git repository history. This flexibility can make it quite slow on big repos, and makes using the command quite difficult, so I will simply point you at the {{ManualPage}} and remind you that {{BestPractice}} is to always use `--tag-name-filter cat -- --all` unless you are really sure you know what you are doing.

BTW, this is the one command I referred to earlier which will update all tags and branches, at least if you use the best practice arguments.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
created: 20150605130505209
modified: 20150606055431278
order: 1
tags: Questions
title: Are you trying to find that which is lost or fix a change that was made?
type: text/vnd.tiddlywiki

Due to previous activities (thrashing about), you may have lost some work which you would like to find and restore. Alternately, you may have made some changes which you would like to fix. Fixing includes updating, rewording, and deleting or discarding.

* [[Fix a change|Have you committed?]]
* [[Find what is lost|I have lost some commits I know I made]]
9 changes: 9 additions & 0 deletions tiddlers/BestPractice.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
created: 20150606034057154
modified: 20150606040447496
tags:
title: BestPractice
type: text/vnd.tiddlywiki
url: http://sethrobertson.github.com/GitBestPractices/

\define ext-link(name, url) [[$name$|$url$]]
<$macrocall $name="ext-link" name="best practice" url={{!!url}}/>
6 changes: 6 additions & 0 deletions tiddlers/CCBYSA.png.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
created: 20150606140622923
modified: 20150606140636196
title: CCBYSA.png
type: image/png

iVBORw0KGgoAAAANSUhEUgAAAFgAAAAfCAYAAABjyArgAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xu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75poBbMmull3Ys3cPtm3fhu+7XM4YrulafVUo4O6du7hx7caaAftNMXgpG7/uAD+RlQtDCNnIMMx/n0CxDhsMQpj/DQDwRbusfJXB0QAAAABJRU5ErkJggg==
13 changes: 13 additions & 0 deletions tiddlers/CC_BY-SA.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
created: 20150606140353318
modified: 20150606142919605
tags:
title: CC BY-SA
type: text/vnd.tiddlywiki

\define cc-link(content) <a rel="license" target="_blank" href="http://creativecommons.org/licenses/by-sa/3.0/">$content$</a>

<div style="text-align: center">
<<cc-link content:"[img[CCBYSA.png]]">>
</div>

This work is licensed under a <<cc-link content:"Creative Commons Attribution-ShareAlike 3.0 International License">>.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
created: 20150605215333425
modified: 20150606055527480
tags: Questions
title: Can you make a positive commit to fix the problem and what is the fix class?
type: text/vnd.tiddlywiki

\define history(url) [[Rewriting public history|$url$#pubonce]]
<$macrocall $name="history" url={{BestPractice!!url}}/> is a bad idea. It requires everyone else to do special things and you must publicly announce your failure. Ideally you will create either a commit to just fix the problem, or a new `git revert` commit to create a new commit which undoes what the commit target of the revert did.

* [[Yes, I can make a new commit but the bad commit trashed a particular file in error (among other good things I want to keep)|Making a new commit to restore a file deleted earlier]]
* [[Yes, I can make a new commit and the bad commit is a merge commit I want to totally remove|Reverting a merge commit]]
* [[Yes, I can make a new commit but the bad commit is a simple commit I want to totally remove|Reverting an old simple pushed commit]]
* [[Yes, I can make a new commit and the bad commit has an error in it I want to fix|Making a new commit to fix an old commit]]
* [[Yes, I can make a new commit but history is all messed up and I have a replacement branch|Rewriting an old branch with a new branch with a new commit]]
* [[No, I am a bad person and must rewrite published history|I am a bad person and must rewrite published history]]
51 changes: 51 additions & 0 deletions tiddlers/Changing_a_single_commit_involving_a_merge.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
created: 20150606004932529
modified: 20150606055934225
tags: Answers
title: Changing a single commit involving a merge
type: text/vnd.tiddlywiki

\define git-cmd(branch)
```sh
git rebase -p --onto $(git rev-parse nonce) HEAD^ $branch$
```
\end

Oh dear. This is going to get a little complicated. It should all work out, though. You will need to use a {{nonce}} branch as a placeholder. I will call the nonce branch "nonce" in the following example. However, you may use any branch name that is not currently in use. You can delete it immediately after you are done.

!! Identify the SHA of the commit you wish to modify.

{{FindingACommit}}

!! Remember the name of the branch you are currently on

The line with a star on it in the `git branch` output is the branch you are currently on. To make things clearer enter in the branch name your interested in: <$edit-text tiddler="$:/data/BranchName" field="branch"/>

!! Create and checkout a nonce branch pointing at that commit.

```sh
git checkout -b nonce SHA
```

Obviously replace "SHA" with the reference you want to modify.

!! Modify the commit

You need to get the index into the correct state you wish the commit to reflect. If you are changing the commit message only, you need do nothing. If you are changing the file contents, typically you would modify the working directory and use `git add` as normal.

Note if you wish to restore a file to a known good state, you can use `git checkout GOODSHA -- path/to/filename`.

Once the index is in the correct state, then you can run `git commit --amend` to update the last commit. Yes, you can use "-a" if you want to avoid the `git add` suggested in the previous paragraph.

If the commit you are updating is a merge commit, ensure that the log message reflects that.

!! Put the remaining commits after the new one you just created

<$macrocall $name="git-cmd" branch={{$:/data/BranchName!!branch}}/>

!! Validate that the topology is still good

If some of the commits after the commit you changed are merge commits, please be warned. It is possible that `git rebase -p` will be unable to properly recreate them. Please inspect the resulting merge topology `gitk --date-order HEAD ORIG_HEAD` to ensure that git did want you wanted. If it did not, there is not really any automated recourse. You can reset back to the commit before the SHA you want to get rid of, and then cherry-pick the normal commits and manually re-merge the "bad" merges. Or you can just suffer with the inappropriate topology (perhaps creating fake merges `git merge --ours otherbranch` so that subsequent development work on those branches will be properly merged in with the correct merge-base).

!! Delete the nonce branch

You don't need it. It was just there to communicate an SHA between two steps in the above process. `git branch -d nonce`
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
created: 20150606041847072
modified: 20150606055950213
tags: Answers
title: Changing a single commit involving only simple commits
type: text/vnd.tiddlywiki

You must first identify the SHA of the commit you wish to remove. {{FindingACommit}}

```sh
git rebase -i SHA^
```

Obviously replace "SHA" with the reference you want to get rid of. The "^" in that command is literal.

You will be dumped in an editor with a bunch of lines starting with pick. The oldest commit, the one you are probably interested in changing, is first. You will want to change the "pick" to "reword" or "edit", or perhaps even "squash" depending on what your goal is. Please read the {{ManualPage}} for more information. A document on [[Post-Production Editing using Git|http://sethrobertson.github.com/GitPostProduction/]] goes through much of the major uses of `git rebase` is some detail. The use case is a little different, but the fundamental techniques are not.

When using "edit", to change contents or author, when you are dumped into the shell to make your change, well make your change, `git add` as normal, and then run `git commit --amend` (including changing the author information with `--author`). When you are satisfied, you should run `git rebase --continue`
10 changes: 10 additions & 0 deletions tiddlers/Changing_all_commits_during_all_of_git's_history.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
created: 20150606033325591
modified: 20150606055552392
tags: Questions
title: Changing all commits during all of git's history
type: text/vnd.tiddlywiki

You have not pushed but still somehow want to change all commits in all of git's history? Strange.

* [[Not just removing data (eg. re-arranging directory structure for all commits), or just wanting to use standard tools|Arbitrarily changing all commits during all of git's history]]
* [[Want to only remove unwanted data (big files, private data, etc) and am willing to use a third party tool to do the job more quickly|Use The BFG to remove unwanted data, like big files or passwords, from Git repository history]]
9 changes: 9 additions & 0 deletions tiddlers/Comments.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
created: 20150606003851462
modified: 20150606054334662
tags: TableOfContents
title: Comments
type: text/vnd.tiddlywiki

Comments and improvements welcome.

[[Use the github issue tracker|https://github.com/SethRobertson/GitFixUm/issues]] or discuss with ~SethRobertson (and others) on [[#git|irc://irc.freenode.net/git]]
26 changes: 26 additions & 0 deletions tiddlers/Copyright.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
created: 20150605123912463
modified: 20150606142923491
tags: TableOfContents
title: Copyright
type: text/vnd.tiddlywiki

\define center(text) <div style="text-align: center">$text$</div>
Copyright ⓒ 2012 [[Seth Robertson]]

This original document is licensed and distributed to you through the use of two licenses. You may pick the license you prefer.

----

{{CC BY-SA}}

<<center "''OR''">>

{{GNU FDL}}

----

Conversion from plain HTML to [[TiddlyWiki|http://tiddlywiki.com/]] was done by [[Devin Weaver]].

I and [[Seth Robertson]] would appreciate changes being sent back to me, being notified if this is used or highlighted in some special way, and links being maintained back to the authoritative source. Thanks.

{{Non Afilliation}}
8 changes: 8 additions & 0 deletions tiddlers/Devin_Weaver.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
created: 20150606051107350
modified: 20150606141346633
title: Devin Weaver
type: text/vnd.tiddlywiki

<$link to="https://github.com/sukima">[img[SukiGravatar]]<br>''@sukima''</$link>

A passionate software developer specialized in ~JavaScript, front end and back end, and mobile iOS development. I dabble in photography, 360 panoramic tours, interactive fiction, and geek culture.
Loading