Compare commits

..

122 commits
v5.0 ... master

Author SHA1 Message Date
Bhupesh-V 38b7be7335 🔖 release 5.9
Some checks failed
build / Linux Test (push) Has been cancelled
2025-04-13 14:41:16 +05:30
Bhupesh-V 2b0936d813 add support for recovering multiple uncommited deleted files (#79) 2025-04-13 14:40:43 +05:30
allcontributors[bot] fc4e473fa2
docs: add luxxmr as a contributor for doc (#78)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-03-18 14:12:13 +05:30
luxxmr 43c205e315
README.md file update to include the "git-undo" command conflict with git-extra. (#77) 2025-03-18 14:11:17 +05:30
Bhupesh Varshney 019646b1ed
add docker pulls 2024-02-07 14:42:34 +05:30
Bhupesh-V ab99ea6110 🐛 my bad, forgot grep (used by undo git rm) 2024-02-06 23:41:00 +05:30
Bhupesh Varshney 8f6e7218da
add package status 2024-02-05 13:47:04 +05:30
Bhupesh-V 0295f27059 🔖 release 5.8 ready 2024-02-03 12:07:32 +05:30
Bhupesh Varshney 75b2cd6e9e
add dockerfile (#72) 2024-02-03 11:57:47 +05:30
Bhupesh Varshney 4cf49f843a
grammar fixes 2024-02-03 11:47:03 +05:30
Bhupesh Varshney 5d6b3688f2
🚸 improve support for running ugit via docker (#68) (#69)
- don't update ugit inside docker
- instead of opening a browser, print the guide URL
- remove usage of basename on help text (#66)
2024-02-02 23:11:16 +05:30
allcontributors[bot] 2489a568cb
docs: add T-Joseph-Kim as a contributor for code (#71)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2024-02-02 23:07:16 +05:30
Taebok Joseph Kim d76d376c30
Removed usage of HEREDOCS and replaced with preferred "printf" statements for printing "--help" text. (#70)
---------

Co-authored-by: Bhupesh Varshney <varshneybhupesh@gmail.com>
2024-02-02 23:05:06 +05:30
Bhupesh-V 7be63fc4c5 🔖 release v5.7 2023-10-20 12:06:19 +05:30
Bhupesh Varshney 1f4a0c57c2
Merge pull request #65 from wrecklass/master
Sort tags by refname in fzf list. Issue #64
2023-10-20 12:04:50 +05:30
Stephen Martin 40289fd584 Sort tags by refname in fzf list. Issue #64 2023-10-18 22:58:45 -06:00
Bhupesh-V 21f96ec035 🔖 release 5.6 2023-05-27 16:01:23 +05:30
Bhupesh Varshney 6db2f6b3d9
Merge pull request #61 from nalin-singh/feature
Added empty list check
2023-05-27 15:59:30 +05:30
Nalin Singh b959579bee Suggestion Resolved 2023-05-26 12:56:44 +05:30
Nalin Singh 7c3a283e43 Added empty list check 2023-05-24 16:16:32 +05:30
Bhupesh-V 8ae45783d2 🔖 release 5.5 2023-03-27 17:27:24 +05:30
Bhupesh Varshney 7c81a3e32f
Merge pull request #60 from Bhupesh-V/all-contributors/add-dr41d45
docs: add dr41d45 as a contributor for code
2023-03-27 17:23:34 +05:30
allcontributors[bot] 44a45f3419
docs: update .all-contributorsrc [skip ci] 2023-03-27 11:53:24 +00:00
allcontributors[bot] d7afd0552a
docs: update README.md [skip ci] 2023-03-27 11:53:23 +00:00
Bhupesh Varshney e58ac52709
Merge pull request #59 from dr41d45/master
Update fzf version comparison to remove letters and parentheses
2023-03-27 17:21:38 +05:30
dr41d45 562dfe8a8a Fix fzf version comparison for --pointer option 2023-03-27 09:25:24 +03:00
dr41d45 19ed0d8c08 Update fzf version comparison to remove letters and parentheses 2023-02-24 16:00:35 +02:00
Bhupesh Varshney 59b1e4fe50
latest news 2022-10-31 10:44:36 +05:30
Bhupesh Varshney 76b4c96fbf
bump release no 2022-10-12 18:40:41 +05:30
Bhupesh Varshney 803ece4a10
Merge pull request #57 from Bhupesh-V/all-contributors/add-Theotime812
docs: add Theotime812 as a contributor for code, and bug
2022-10-09 11:53:23 +05:30
allcontributors[bot] 60928bad9f
docs: update .all-contributorsrc [skip ci] 2022-10-09 06:22:51 +00:00
allcontributors[bot] f845e84a8c
docs: update README.md [skip ci] 2022-10-09 06:22:50 +00:00
Bhupesh Varshney dd91afca46
Merge pull request #56 from Theotime812/master
Added support for fzf < 0.21.0
2022-10-09 11:52:05 +05:30
Théotime Maillarbaux 77b1f7f24a
Added double quotes around new variables when they're used 2022-10-08 01:58:18 +02:00
thmaillarb b5d650181a Added support for fzf < 0.21.0 2022-10-05 15:20:01 +02:00
Bhupesh-V 7fb08530fa update application id 2022-09-18 13:57:40 +05:30
Bhupesh Varshney 6d5fe5aa61
Merge pull request #54 from Bhupesh-V/all-contributors/add-RohitSingh107
add RohitSingh107 as a contributor
2022-09-18 13:44:19 +05:30
allcontributors[bot] 8fcf45c947
update .all-contributorsrc [skip ci] 2022-09-18 08:14:09 +00:00
allcontributors[bot] 60137bbb86
update README.md [skip ci] 2022-09-18 08:14:08 +00:00
Bhupesh Varshney 8bf1dec8ed
Merge pull request #53 from RohitSingh107/master
added flatpak
2022-09-18 13:43:12 +05:30
Rohit 1c698ca10b added flatpak 2022-09-08 22:30:09 +05:30
Bhupesh Varshney cd5960b2f4
Merge pull request #52 from thecesrom/fix/undo-initial-commit-printf-success
fix: `printf` command when undoing initial commit
2022-08-29 11:23:28 +05:30
César Román 78f3e559f3
fix: fix printf command when undoing initial commit 2022-08-27 17:08:49 -07:00
Bhupesh-V 14da50780e 🐛 fix incorrect invocation of perror 2022-08-27 12:31:26 +05:30
Bhupesh Varshney ab2cccb9ba
Merge pull request #51 from kopalchakravarty/add_bug_report_url
Add Bug Report URL
2022-08-27 12:23:22 +05:30
Kopal Chakravarty ec4e4eea57
Merge branch 'Bhupesh-V:master' into add_bug_report_url 2022-08-26 12:07:52 +05:30
kopalchakravarty 8608fcd0a4 Fix error condition 2022-08-26 12:05:39 +05:30
Bhupesh-V 55d743f445 fix headings in installation doc 2022-08-26 12:03:26 +05:30
Bhupesh-V 87ed8b447a 🛂 change strategy to show release changelog
Unfortunately we can't parse the markdown text correctly returned by the API
We will now mention the release URL to read changelog instead of doing any smart text wrangling.
2022-08-26 11:56:23 +05:30
kopalchakravarty 9a27136a86 Invoke error function: handle error cases 2022-08-26 11:53:47 +05:30
Bhupesh Varshney 7c97133bd5
Merge pull request #50 from Bhupesh-V/all-contributors/add-vinayaknayar
docs: add vinayaknayar as a contributor for doc
2022-08-26 11:52:37 +05:30
allcontributors[bot] 57b554b40c
docs: update .all-contributorsrc [skip ci] 2022-08-26 06:22:09 +00:00
allcontributors[bot] aa02fd3222
docs: update README.md [skip ci] 2022-08-26 06:22:08 +00:00
Bhupesh Varshney 711da942fc
Merge pull request #48 from vinayaknayar/doc-fixes
installation guide for windows
2022-08-26 11:51:29 +05:30
kopalchakravarty 10edf04217 Add:Bug report URL 2022-08-26 11:32:14 +05:30
vinayaknayar f8b761773c indented the code blocks 2022-08-25 22:41:28 +05:30
Bhupesh Varshney 076516c026
Merge pull request #49 from Bhupesh-V/all-contributors/add-nalin-singh
docs: add nalin-singh as a contributor for code
2022-08-25 12:58:48 +05:30
allcontributors[bot] 23af318e87
docs: update .all-contributorsrc [skip ci] 2022-08-25 07:28:27 +00:00
allcontributors[bot] db848b898d
docs: update README.md [skip ci] 2022-08-25 07:28:26 +00:00
Bhupesh Varshney f352175a0b
Merge pull request #47 from nalin-singh/feature
Add: Undo git rm
2022-08-25 12:57:40 +05:30
vinayaknayar ec793ae4fe md lists instead of headings 2022-08-25 12:19:27 +05:30
Nalin Singh 64714b2e85 Removed Unwanted Message 2022-08-25 11:52:42 +05:30
vinayaknayar 1e30dc5185 installation guide for windows 2022-08-24 22:15:28 +05:30
Nalin Singh 5ead678252 Add: Undo git rm 2022-08-24 19:09:08 +05:30
Bhupesh Varshney ccba21fec4
Merge pull request #46 from Bhupesh-V/all-contributors/add-zora89
docs: add zora89 as a contributor for doc
2022-08-22 18:33:43 +05:30
allcontributors[bot] 146c84d92a
docs: update .all-contributorsrc [skip ci] 2022-08-22 13:03:30 +00:00
allcontributors[bot] e8f18dbb37
docs: update README.md [skip ci] 2022-08-22 13:03:29 +00:00
Bhupesh Varshney ccc7fad303
Merge pull request #45 from zora89/master
Improved Intro Articulation
2022-08-22 18:32:41 +05:30
Zorawar Purohit 7c071eb76f
Update README.md
Co-authored-by: Bhupesh Varshney <varshneybhupesh@gmail.com>
2022-08-22 18:29:13 +05:30
Zorawar Purohit e1a13d55eb
Improved Intro Aritculation 2022-08-22 01:04:49 +05:30
Bhupesh Varshney 1d7e449b2a
git tag 2022-08-16 11:06:46 +05:30
Bhupesh-V 0f90c6eee5 🔖 bump ugit version 2022-08-15 23:15:14 +05:30
Bhupesh Varshney 90d587e7f5
Merge pull request #43 from kopalchakravarty/fix_undo_initial_commit
Fix: Undo Initial Commit
2022-08-15 22:46:32 +05:30
kopalchakravarty dd6b72346d Fix: undo initial commit- update comments 2022-08-15 16:04:53 +05:30
kopalchakravarty ae010592da Fix: Undo initial commit 2022-08-12 16:26:01 +05:30
kopalchakravarty 28d97306ee Revert "Fix: Undo initial commit"
This reverts commit 04a8539133.
2022-08-12 16:21:06 +05:30
kopalchakravarty ed56709797 Merge branch 'fix_undo_initial_commit' of github.com:kopalchakravarty/ugit into fix_undo_initial_commit 2022-08-12 16:18:33 +05:30
kopalchakravarty 04a8539133 Fix: Undo initial commit 2022-08-12 16:18:21 +05:30
kopalchakravarty dcccd0c819 Fix: Undo initial commit 2022-08-12 16:15:42 +05:30
Bhupesh Varshney be9988d4fb
Update README.md 2022-08-11 18:39:46 +05:30
Bhupesh Varshney 0e3bbc5df0
fix order of data 2022-08-11 18:35:49 +05:30
Bhupesh Varshney 24e015e0ea
get total downloads across brew & github 2022-08-11 18:32:29 +05:30
Bhupesh Varshney 71d5b1861a
Merge pull request #42 from Bhupesh-V/all-contributors/add-kopalchakravarty
docs: add kopalchakravarty as a contributor for code
2022-08-10 11:36:48 +05:30
allcontributors[bot] 4d22083dce
docs: update .all-contributorsrc [skip ci] 2022-08-10 06:06:22 +00:00
allcontributors[bot] 40576b8d2e
docs: update README.md [skip ci] 2022-08-10 06:06:21 +00:00
Bhupesh Varshney 2b6ef55c7f
Merge pull request #40 from kopalchakravarty/undo_git_tag
Add: Undo 'git tag'
2022-08-10 11:35:26 +05:30
kopalchakravarty 9474cff2c2 Update ugit: Undo git tag 2022-08-09 21:28:39 +05:30
Kopal Chakravarty df0818bdc7
Update ugit: undo git tag
Co-authored-by: Bhupesh Varshney <varshneybhupesh@gmail.com>
2022-08-09 21:24:44 +05:30
kopalchakravarty 7e8838be76 Update ugit: Undo tag 2022-08-09 14:30:45 +05:30
Kopal Chakravarty c16a6d9114
Update ugit: fix syntax
Co-authored-by: Bhupesh Varshney <varshneybhupesh@gmail.com>
2022-08-09 09:11:11 +05:30
Kopal Chakravarty 55a92b20f8
Update ugit: fix syntax
Co-authored-by: Bhupesh Varshney <varshneybhupesh@gmail.com>
2022-08-09 09:10:57 +05:30
kopalchakravarty 032e20e3e4 Add functionality: undo git tag 2022-08-08 14:36:51 +05:30
Bhupesh Varshney 5004807b4f
Update pull_request_template.md 2022-08-03 12:16:23 +05:30
Bhupesh Varshney 38e9e5e50d
make ugit news better 2022-08-03 00:01:01 +05:30
Bhupesh-V 6ab6f26955 remove feature request template 2022-07-19 18:33:39 +05:30
Bhupesh-V 5c8d24b114 remove unnecessary forms 2022-07-19 18:32:39 +05:30
Bhupesh-V a994c51477 new bug report template 2022-07-19 18:24:00 +05:30
Bhupesh Varshney 01d3c5fc6d
improve docs
- add 1 more community link
- 1 more reason to use ugit
2022-07-11 12:32:44 +05:30
Bhupesh Varshney 35b783c5f1
Merge pull request #35 from sullivan-sean/patch-1
Fix broken link to Ilkin Bayramli's profile
2022-06-25 00:02:46 +05:30
Sean Sullivan cb0606a06b
Fix broken link to Ilkin Bayramli's profile 2022-06-24 11:16:23 -07:00
Bhupesh Varshney f7adf00bbc
Merge pull request #33 from Bhupesh-V/all-contributors/add-ibayramli2001
docs: add ibayramli2001 as a contributor for platform
2022-06-15 22:36:34 +05:30
allcontributors[bot] b30036d5c9
docs: update .all-contributorsrc [skip ci] 2022-06-15 17:05:57 +00:00
allcontributors[bot] 2be7410f74
docs: update README.md [skip ci] 2022-06-15 17:05:56 +00:00
Bhupesh Varshney 9561a19b28
Merge pull request #32 from ibayramli2001/fig
Add Fig as an installation method to the README
2022-06-15 22:34:23 +05:30
Ilkin Bayramli 8d4e75d718
Add Fig as an installation method to the README 2022-06-15 09:54:28 -07:00
Bhupesh Varshney 322580cb98
add details about windows support 2022-06-08 19:51:50 +05:30
Bhupesh Varshney 62975a8594
remove ko-fi from funding 2022-06-08 19:47:32 +05:30
Bhupesh-V fef1cd6b51 🔧 add support for setting up gitconfig while installing (linux only) 2022-06-07 20:08:41 +05:30
Bhupesh-V 0c159873c1 new installation script for Linux users 2022-06-06 10:56:53 +05:30
Bhupesh Varshney ca8d67d3fc
add link to git undo talk 2022-05-18 19:14:58 +05:30
Bhupesh Varshney 74a88c55ee
add opencollective 2022-05-14 21:03:46 +05:30
Bhupesh Varshney d78ced2315
add git guide badge 2022-05-14 11:36:12 +05:30
Bhupesh Varshney 43ff413f8d
remove author info 2022-04-27 19:50:54 +05:30
Bhupesh Varshney d0be3d9a4e
update installation docs for Mac 2022-04-05 20:19:00 +05:30
Bhupesh Varshney ed8f14a124
bump version 2022-02-18 11:56:55 +05:30
Bhupesh Varshney 435d8302a6
Merge pull request #24 from Bhupesh-V/all-contributors/add-thecesrom
docs: add thecesrom as a contributor for code, bug
2022-02-18 11:46:07 +05:30
allcontributors[bot] 3299e3b6a8
docs: update .all-contributorsrc [skip ci] 2022-02-18 06:15:39 +00:00
allcontributors[bot] e5bb06b0a9
docs: update README.md [skip ci] 2022-02-18 06:15:38 +00:00
Bhupesh Varshney 8071a762f4
Merge pull request #22 from thecesrom/fix/init_test
fix: update strategy for detecting top-level directory
2022-02-18 11:44:18 +05:30
César Román 3a68527405
fix: update strategy for detecting top-level directory
the previous method resulted in a false positive on Git BASH for Windows
2022-02-16 14:20:34 -08:00
Bhupesh Varshney 14d687ccf5
Update README.md 2021-12-08 21:52:40 +05:30
Bhupesh Varshney dfd7401242
add newer demo 2021-10-02 12:14:21 +05:30
17 changed files with 796 additions and 174 deletions

View file

@ -35,6 +35,107 @@
"doc",
"plugin"
]
},
{
"login": "thecesrom",
"name": "César Román",
"avatar_url": "https://avatars.githubusercontent.com/u/19418023?v=4",
"profile": "https://thecesrom.dev/",
"contributions": [
"code",
"bug"
]
},
{
"login": "ibayramli2001",
"name": "Ilkin Bayramli",
"avatar_url": "https://avatars.githubusercontent.com/u/43158991?v=4",
"profile": "https://github.com/ibayramli2001",
"contributions": [
"platform"
]
},
{
"login": "kopalchakravarty",
"name": "Kopal Chakravarty",
"avatar_url": "https://avatars.githubusercontent.com/u/31576619?v=4",
"profile": "https://github.com/kopalchakravarty",
"contributions": [
"code"
]
},
{
"login": "zora89",
"name": "Zorawar Purohit",
"avatar_url": "https://avatars.githubusercontent.com/u/42845567?v=4",
"profile": "https://www.zorawarpurohit.com",
"contributions": [
"doc"
]
},
{
"login": "nalin-singh",
"name": "Nalin Singh",
"avatar_url": "https://avatars.githubusercontent.com/u/38408670?v=4",
"profile": "https://craftic.webflow.io",
"contributions": [
"code"
]
},
{
"login": "vinayaknayar",
"name": "vinayaknayar",
"avatar_url": "https://avatars.githubusercontent.com/u/98237998?v=4",
"profile": "https://github.com/vinayaknayar",
"contributions": [
"doc"
]
},
{
"login": "RohitSingh107",
"name": "RohitSingh107",
"avatar_url": "https://avatars.githubusercontent.com/u/64142943?v=4",
"profile": "https://github.com/RohitSingh107",
"contributions": [
"platform"
]
},
{
"login": "Theotime812",
"name": "Théotime Maillarbaux",
"avatar_url": "https://avatars.githubusercontent.com/u/45947878?v=4",
"profile": "https://github.com/Theotime812",
"contributions": [
"code",
"bug"
]
},
{
"login": "dr41d45",
"name": "dr41d45",
"avatar_url": "https://avatars.githubusercontent.com/u/47773787?v=4",
"profile": "https://github.com/dr41d45",
"contributions": [
"code"
]
},
{
"login": "T-Joseph-Kim",
"name": "Taebok Joseph Kim",
"avatar_url": "https://avatars.githubusercontent.com/u/116681578?v=4",
"profile": "https://github.com/T-Joseph-Kim",
"contributions": [
"code"
]
},
{
"login": "luxxmr",
"name": "luxxmr",
"avatar_url": "https://avatars.githubusercontent.com/u/185298948?v=4",
"profile": "https://github.com/luxxmr",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,
@ -42,5 +143,7 @@
"projectOwner": "Bhupesh-V",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true
"skipCi": true,
"commitConvention": "angular",
"commitType": "docs"
}

6
.github/FUNDING.yml vendored
View file

@ -1,8 +1,8 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
open_collective: # Replace with a single Open Collective username
ko_fi: bhupesh
github: Bhupesh-V
open_collective: ugit
ko_fi: # bhupesh
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
issuehunt: # Replace with a single IssueHunt username

View file

@ -1,29 +0,0 @@
---
name: "\U0001F41B Bug report"
about: Create a report to help us improve ugit
title: ''
labels: 'bug'
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. Ubuntu]
- Bash Version [e.g. 4.4.20]
- FZF Version: [e.g. 0.21.0]
- Git Version: [e.g. 2.31.1]
**Additional context**
Add any other context about the problem here.

View file

@ -1,20 +0,0 @@
---
name: "\U0001F680 Feature request"
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -1,10 +0,0 @@
---
name: "❓ Question"
about: Ask any questions
title: ''
labels: question
assignees: ''
---

View file

@ -1,18 +0,0 @@
---
name: "\U0001F49F Say thank you"
about: Just say thanks if you liked ugit
title: ''
labels: ''
assignees: ''
---
if you liked **ugit** - please let us know. We'd love to hear from you!
You can help me in any way possible
- [ ] Give the repository a star ⭐️
- [ ] Help out with issues
- [ ] Share ugit with others
Thank you! 💐

76
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View file

@ -0,0 +1,76 @@
name: 🐛 Bug Report
description: Create a report to help us improve ugit
labels: ["bug"]
assignees:
- Bhupesh-V
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see! Any log outputs, demo screenshots
value: "A bug happened!"
validations:
required: true
- type: dropdown
id: ugit-version
attributes:
label: Ugit Version
description: What version of ugit are you running?
options:
- v5.1 (Latest)
- v5.0
- v4.1
- v4.0
- v3.0
- v2.0
- v1.0
validations:
required: true
- type: dropdown
id: bash-version
attributes:
label: Bash Version
description: What version of bash are you running?
options:
- Bash >= 5.0
- Bash >= 4.0
- Bash >= 3.0
validations:
required: true
- type: textarea
id: git-version
attributes:
label: Git Version
description: Please paste the output of `git --version`
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: What OS are you seeing the problem on?
multiple: false
options:
- Linux Based
- MacOS
- Windows
validations:
required: true
- type: textarea
id: terminalName
attributes:
label: Terminal Name
description: Please specify the name of terminal you are using (E.g Kitty, iterm2 etc.)
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Bhupesh-V/ugit/blob/master/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true

View file

@ -0,0 +1,26 @@
name: 🚀 Feature request
description: Suggest an idea for this project
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to request for more features!
- type: textarea
id: got-a-problem
attributes:
label: Is your feature request related to a problem? Please describe.
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
id: have-any-solution
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: false
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.

View file

@ -7,8 +7,8 @@ Please include a summary of the change and which issue is fixed. Please also inc
For e.g #45
-->
### Screenshots / Gifs
<!-- remove above line if not applicable -->
### Screenshots / Gifs:
<!-- Please any demo video/GIFs to showcase changes -->
### Changes Include
@ -19,8 +19,17 @@ For e.g #45
- [ ] Tooling ⚙️ (Changes to the build process or auxiliary tools and libraries such as documentation generation)
- [ ] Performance ⚡ (code change that improves performance)
## How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [ ] Test A
- [ ] Test B
### Checklist
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] My changes generate no new warnings
- [ ] I have performed a self-review of my own code
- [ ] I have checked my code and corrected any misspellings

26
.github/workflows/download-stats.yml vendored Normal file
View file

@ -0,0 +1,26 @@
name: Get ugit Download Stats
on:
workflow_dispatch:
schedule:
# everyday 9:30 pm
- cron: '0 16 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Download Count
id: downloads
run: |
echo ::set-output name=download_count::$((curl -sq https://formulae.brew.sh/api/formula/ugit.json | jq '.analytics.install_on_request."365d".ugit' | tr "\012" "+" && (curl -sq https://api.github.com/repos/Bhupesh-V/ugit/releases | jq .[].assets[0].download_count | tr "\012" "+" ; echo "0")) | bc)
- name: Create Awesome Badge
uses: schneegans/dynamic-badges-action@v1.1.0
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: 6b7b8e8576bc1ca237bffd9a344672ab
filename: ugit-downloads.json
label: downloads
message: ${{ steps.downloads.outputs.download_count }}
color: "#820F82"

71
Dockerfile Normal file
View file

@ -0,0 +1,71 @@
FROM alpine:3.18 as ugit-ops
RUN apk add --no-cache \
bash \
coreutils \
git \
ncurses \
curl
# Download fzf binary from GitHub, pin to 0.46.0, ugit requires minimum 0.21.0
RUN curl -L -o fzf.tar.gz https://github.com/junegunn/fzf/releases/download/0.46.0/fzf-0.46.0-linux_amd64.tar.gz && \
tar -xzf fzf.tar.gz && \
mv fzf /usr/bin/
# Copy only the ugit script into the container at /app
COPY ugit .
# Set permissions and move the script to path
RUN chmod +x ugit && mv ugit /usr/bin/
# Second stage: Copy only necessary binaries and their dependencies
FROM scratch
LABEL description="Undo your last oopsie in git with ugit"
LABEL maintainer="Bhupesh Varshney <varshneybhupesh@gmail.com>"
COPY --from=ugit-ops /usr/bin/ugit /bin/
COPY --from=ugit-ops /usr/bin/git /usr/bin/
COPY --from=ugit-ops /usr/bin/fzf /usr/bin/
COPY --from=ugit-ops /usr/bin/tput /usr/bin/
COPY --from=ugit-ops /usr/bin/nl /usr/bin/
COPY --from=ugit-ops /usr/bin/awk /usr/bin/
COPY --from=ugit-ops /usr/bin/xargs /usr/bin/
COPY --from=ugit-ops /usr/bin/cut /usr/bin/
COPY --from=ugit-ops /usr/bin/tr /usr/bin/
COPY --from=ugit-ops /bin/bash /bin/
COPY --from=ugit-ops /bin/grep /bin/
# copy lib files
# COPY --from=ugit-ops /usr/lib/libncursesw* /usr/lib/
COPY --from=ugit-ops /usr/lib/libncursesw.so.6 /usr/lib/
# COPY --from=ugit-ops /usr/lib/libpcre* /usr/lib/
COPY --from=ugit-ops /usr/lib/libpcre2-8.so.0 /usr/lib/
# COPY --from=ugit-ops /usr/lib/libreadline* /usr/lib/
COPY --from=ugit-ops /usr/lib/libreadline.so.8 /usr/lib/
COPY --from=ugit-ops /lib/libacl.so.1 /lib/
COPY --from=ugit-ops /lib/libattr.so.1 /lib/
COPY --from=ugit-ops /lib/libc.musl-* /lib/
COPY --from=ugit-ops /lib/ld-musl-* /lib/
COPY --from=ugit-ops /lib/libutmps.so.0.1 /lib/
COPY --from=ugit-ops /lib/libskarnet.so.2.13 /lib/
COPY --from=ugit-ops /lib/libz.so.1 /lib/
# copy terminfo database
COPY --from=ugit-ops /etc/terminfo/x/xterm-256color /usr/share/terminfo/x/
# Gib me all the colors
ENV TERM=xterm-256color
# Let fzf know our deault shell
ENV SHELL=/bin/bash
# Let ugit know we are running in docker
ENV UGIT_RUNNING_IN_DOCKER=true
WORKDIR /app
# Run ugit when the container launches
ENTRYPOINT ["/bin/bash", "/bin/ugit"]

163
README.md
View file

@ -5,17 +5,20 @@
<a href="https://github.com/Bhupesh-V/ugit/actions/workflows/build.yml">
<img alt="build ugit" src="https://github.com/Bhupesh-V/ugit/actions/workflows/build.yml/badge.svg">
</a>
<a href="https://github.com/Bhupesh-V/ugit/blob/master/LICENSE">
<img alt="License: MIT" src="https://img.shields.io/github/license/Bhupesh-V/ugit" target="_blank" />
<a href="https://hub.docker.com/r/bhupeshimself/ugit">
<img alt="Docker pulls" src="https://img.shields.io/docker/pulls/bhupeshimself/ugit?logo=docker" target="_blank" />
</a>
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/Bhupesh-V/ugit/total?color=orange">
<img alt="total downloads (github + brew)" src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Bhupesh-V/6b7b8e8576bc1ca237bffd9a344672ab/raw/ugit-downloads.json">
<a href="">
<img alt="platform support linux and macos" src="https://img.shields.io/badge/platform-GNU/Linux %7C MacOS-blue">
</a>
<a href="https://til.bhupesh.me/git/how-to-undo-anything-in-git">
<img alt="git undo text guide" src="https://img.shields.io/badge/guide-git%20undo-orange">
</a>
<a href="https://twitter.com/bhupeshimself">
<img alt="Twitter: bhupeshimself" src="https://img.shields.io/twitter/follow/bhupeshimself.svg?style=social" target="_blank" />
</a><br><br>
<img align="center" title="ugit demo: restore file to a previous commit" alt="ugit demo: restore file gif" src="https://user-images.githubusercontent.com/34342551/117250614-19a16380-ae61-11eb-97a9-8ba1695cc50a.gif"><br>
<img align="center" title="ugit demo: restore file to a previous commit" alt="ugit demo: restore file gif" src="https://user-images.githubusercontent.com/34342551/135706491-0e987e0c-3a6d-4da6-bd16-d69bb36c42a9.gif"><br>
</p>
<h2><details><summary>More Video Demos ✨️</summary>
@ -34,17 +37,18 @@ https://user-images.githubusercontent.com/34342551/121651071-d9fd1580-cab7-11eb-
</details></h2>
## Why `ugit`
## Why use `ugit`?
- You accidentally ran a `git` command you wish to 'undo'.
- You want to save time by not searching for _how to undo ..._
- Your focus is on the problems at hand and not on Git (avoid context switching)
- You did an accidental `git` command you didn't want to.
- You don't want to waste your time searching on _how to undo ..._
- Because `ugit` is cool
### [Motivations behind writing ugit 🙇‍♂️️](https://bhupesh-v.github.io/undo-your-last-git-mistake-with-ugit)
## What's in the box
## What's in the box?
`ugit`/`git-undo` supports undoing following operations, some are a WIP. If you know of any other operations that can be undone and is not in the list, make sure to send a quick PR 💛️
`ugit`/`git-undo` supports undoing the following operations, some are a WIP. If you know of any other operations that can be undone and are not in the list, make sure to raise an issue or make a quick PR 💛️
- [x] Undo `git commit`
- [x] Undo `git add`
@ -59,28 +63,38 @@ https://user-images.githubusercontent.com/34342551/121651071-d9fd1580-cab7-11eb-
- [x] Undo (Restore) a file to a previous version
- [x] Undo `git merge`
- [x] Undo `git cherry-pick`
- [ ] Undo `git tag` (rename a tag)
- [x] Undo `git tag`
- [ ] Undo `git rebase`
- [ ] Undo `git worktree remove` (recover deleted work-tree)
Help me finish above tasks by contributing?
Contribute to the project by helping me with the above-mentioned tasks.
Have any other ideas/suggestions? [**Hop in to ugit discussions 💬️**](https://github.com/Bhupesh-V/ugit/discussions/7)
If you have any other ideas/suggestions, do send them across. [**Hop in to ugit discussions 💬️**](https://github.com/Bhupesh-V/ugit/discussions/7)
## `ugit` in ...
## News
### News
| When | What |
|:--------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 29 Oct, 2022 | ugit crossed 1k stars |
| 02 June, 2022 | [console.dev](https://console.dev/tools/) featured [ugit](https://twitter.com/bhupeshimself/status/1532714651842396161) |
| 18 May, 2022 | I gave a talk about the git tooling ecosystem & `git undo` in [Undo git, say whaat! - **GitHub India Constellation**, May 2022](https://youtu.be/jpR9BMFmh4Y?t=15240) |
| 12 May, 2021 | The [guide was **tweeted by GitHub**](https://twitter.com/github/status/1392207961355862018?s=20) (I was logging my research process there while building ugit) |
| 30 April, 2021 | Featured on [**Changelog News**](https://changelog.com/news/ugit-helps-you-undo-your-last-git-command-with-grace-8X6L) |
- Featured on [**Changelog News**](https://changelog.com/news/ugit-helps-you-undo-your-last-git-command-with-grace-8X6L#discussion)
- The [guide was **tweeted by GitHub**](https://twitter.com/github/status/1392207961355862018?s=20) (I was logging my research process there while building ugit)
## Community
### Community
- Alexander Alemayhu made a youtube tutorial on [Undoing Your Last Git Commit with Ugit](https://www.youtube.com/watch?v=nUnCgKb4tSc)
- Alexander Alemayhu made a YouTube tutorial on [Undoing Your Last Git Commit with Ugit](https://www.youtube.com/watch?v=nUnCgKb4tSc)
## Installation
[Try `ugit` via Docker](https://hub.docker.com/r/bhupeshimself/ugit):
```bash
docker pull bhupeshimself/ugit
docker run --rm -it -v $(pwd):/app bhupeshimself/ugit
```
### Prerequisites
**ugit** dependencies:
@ -90,26 +104,61 @@ Have any other ideas/suggestions? [**Hop in to ugit discussions 💬️**](https
- [**fzf**](https://github.com/junegunn/fzf) >= `0.21.0` - [Installation guide](https://github.com/junegunn/fzf#installation)
- GNU utils like `awk`, `grep`, `tput` etc
### Manual Installation
<br>
1. Install the script using `curl`
[![Packaging status](https://repology.org/badge/vertical-allrepos/ugit.svg)](https://repology.org/project/ugit/versions)
**Linux**
```bash
curl -fsSL https://github.com/Bhupesh-V/ugit/releases/latest/download/ugit -o ugit && chmod +x ugit && mv ugit $HOME/.local/bin/
### Linux
```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
```
Arch Linux users can install [**ugit via AUR**](https://aur.archlinux.org/packages/ugit).
### Mac
```bash
brew install ugit
```
### Windows
To use ugit on Windows you need to install:
1. Git Bash<br>
Git bash comes with git (if you have installed it on your machine then no need). To install git (preferably with scoop):
```
scoop install git
```
2. FZF
```
**Mac**
```bash
curl -fsSL https://github.com/Bhupesh-V/ugit/releases/latest/download/ugit -o ugit && chmod +x ugit && mv ugit /usr/local/bin
scoop install fzf
```
Alternatively, with Chocolatey:
Or Arch Linux users can install [**ugit via AUR**](https://aur.archlinux.org/packages/ugit).
2. Verify installation
```bash
ugit --version
```
choco install fzf
```
3. To use bash in terminal change your directory to `**git\2.35.3.windows.1\bin\bash**` accordingly.
4. Then either clone the repo,
```bash
git clone https://github.com/Bhupesh-V/ugit.git
```
or get it using curl:
```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
```
### Fig
[Fig](https://fig.io) adds apps, shortcuts, and autocomplete to your existing terminal.
Install `ugit` in just one click.
<a href="https://fig.io/plugins/other/ugit_Bhupesh-V" target="_blank"><img src="https://fig.io/badges/install-with-fig.svg" /></a>
### ZSH Frameworks
@ -143,6 +192,15 @@ If you're using [oh-my-zsh](github.com/robbyrussell/oh-my-zsh):
`source ~/.zshrc`
### Note on `git-undo` Command Conflict
If you have both `ugit` and `git-extras` (https://github.com/tj/git-extras) installed, be aware that both provide a `git-undo` command. This can lead to conflicts, as only one version of the command will be accessible at a time. To resolve this:
- **Using Homebrew**: Homebrew will notify you of the conflict during installation. You can choose to unlink the conflicting formula or use the --overwrite flag to force the link as follows:
`brew link --overwrite ugit`
- **Manual Installation**: Ensure that the `git-undo` command from the desired package is prioritized in your system's PATH.
## Please read ⚠️
@ -150,14 +208,14 @@ If you're using [oh-my-zsh](github.com/robbyrussell/oh-my-zsh):
Git comes with a garbage collector ([in case you didn't know](https://git-scm.com/docs/git-gc)) therefore undoing some commands will become impossible if the entries are deleted from the reflog.
One way to prevent this is to increase default time limits before the reflog entries expire.
Add these configuration in your global `.gitconfig` file:
Add these configurations in your global `.gitconfig` file:
```gitconfig
[gc]
# default 90 days
reflogExpire = 200
```
Used to set how long records in a branches reflog should be preserved.
Used to set how long records in a branch reflog should be preserved.
```gitconfig
[gc]
@ -171,14 +229,6 @@ Used to set how long inaccessible reflog records should be preserved.
You can read my in-process guide on [**How to undo anything in Git**](https://bhupesh.gitbook.io/notes/git/how-to-undo-anything-in-git)
## Author
:bust_in_silhouette: **Bhupesh Varshney**
- Web : [bhupesh-v.github.io](https://bhupesh-v.github.io)
- Twitter : [@bhupeshimself](https://twitter.com/bhupeshimself)
- DEV : [bhupesh](https://dev.to/bhupesh)
## Credit & Thanks
To all the SO threads that I will probably never visit again ;)
@ -205,11 +255,26 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/sharan-aithal"><img src="https://avatars.githubusercontent.com/u/32029982?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sharan Aithal</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=sharan-aithal" title="Code">💻</a> <a href="https://github.com/Bhupesh-V/ugit/commits?author=sharan-aithal" title="Documentation">📖</a></td>
<td align="center"><a href="https://tabulate.tech"><img src="https://avatars.githubusercontent.com/u/58576759?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tabulate</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=TabulateJarl8" title="Code">💻</a> <a href="#platform-TabulateJarl8" title="Packaging/porting to new platform">📦</a></td>
<td align="center"><a href="http://unixorn.github.io"><img src="https://avatars.githubusercontent.com/u/23920?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Joe Block</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=unixorn" title="Code">💻</a> <a href="https://github.com/Bhupesh-V/ugit/commits?author=unixorn" title="Documentation">📖</a> <a href="#plugin-unixorn" title="Plugin/utility libraries">🔌</a></td>
</tr>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sharan-aithal"><img src="https://avatars.githubusercontent.com/u/32029982?v=4?s=100" width="100px;" alt="Sharan Aithal"/><br /><sub><b>Sharan Aithal</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=sharan-aithal" title="Code">💻</a> <a href="https://github.com/Bhupesh-V/ugit/commits?author=sharan-aithal" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://tabulate.tech"><img src="https://avatars.githubusercontent.com/u/58576759?v=4?s=100" width="100px;" alt="Tabulate"/><br /><sub><b>Tabulate</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=TabulateJarl8" title="Code">💻</a> <a href="#platform-TabulateJarl8" title="Packaging/porting to new platform">📦</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://unixorn.github.io"><img src="https://avatars.githubusercontent.com/u/23920?v=4?s=100" width="100px;" alt="Joe Block"/><br /><sub><b>Joe Block</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=unixorn" title="Code">💻</a> <a href="https://github.com/Bhupesh-V/ugit/commits?author=unixorn" title="Documentation">📖</a> <a href="#plugin-unixorn" title="Plugin/utility libraries">🔌</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://thecesrom.dev/"><img src="https://avatars.githubusercontent.com/u/19418023?v=4?s=100" width="100px;" alt="César Román"/><br /><sub><b>César Román</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=thecesrom" title="Code">💻</a> <a href="https://github.com/Bhupesh-V/ugit/issues?q=author%3Athecesrom" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ibayramli2001"><img src="https://avatars.githubusercontent.com/u/43158991?v=4?s=100" width="100px;" alt="Ilkin Bayramli"/><br /><sub><b>Ilkin Bayramli</b></sub></a><br /><a href="#platform-ibayramli2001" title="Packaging/porting to new platform">📦</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kopalchakravarty"><img src="https://avatars.githubusercontent.com/u/31576619?v=4?s=100" width="100px;" alt="Kopal Chakravarty"/><br /><sub><b>Kopal Chakravarty</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=kopalchakravarty" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.zorawarpurohit.com"><img src="https://avatars.githubusercontent.com/u/42845567?v=4?s=100" width="100px;" alt="Zorawar Purohit"/><br /><sub><b>Zorawar Purohit</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=zora89" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://craftic.webflow.io"><img src="https://avatars.githubusercontent.com/u/38408670?v=4?s=100" width="100px;" alt="Nalin Singh"/><br /><sub><b>Nalin Singh</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=nalin-singh" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/vinayaknayar"><img src="https://avatars.githubusercontent.com/u/98237998?v=4?s=100" width="100px;" alt="vinayaknayar"/><br /><sub><b>vinayaknayar</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=vinayaknayar" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RohitSingh107"><img src="https://avatars.githubusercontent.com/u/64142943?v=4?s=100" width="100px;" alt="RohitSingh107"/><br /><sub><b>RohitSingh107</b></sub></a><br /><a href="#platform-RohitSingh107" title="Packaging/porting to new platform">📦</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Theotime812"><img src="https://avatars.githubusercontent.com/u/45947878?v=4?s=100" width="100px;" alt="Théotime Maillarbaux"/><br /><sub><b>Théotime Maillarbaux</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=Theotime812" title="Code">💻</a> <a href="https://github.com/Bhupesh-V/ugit/issues?q=author%3ATheotime812" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/dr41d45"><img src="https://avatars.githubusercontent.com/u/47773787?v=4?s=100" width="100px;" alt="dr41d45"/><br /><sub><b>dr41d45</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=dr41d45" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/T-Joseph-Kim"><img src="https://avatars.githubusercontent.com/u/116681578?v=4?s=100" width="100px;" alt="Taebok Joseph Kim"/><br /><sub><b>Taebok Joseph Kim</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=T-Joseph-Kim" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/luxxmr"><img src="https://avatars.githubusercontent.com/u/185298948?v=4?s=100" width="100px;" alt="luxxmr"/><br /><sub><b>luxxmr</b></sub></a><br /><a href="https://github.com/Bhupesh-V/ugit/commits?author=luxxmr" title="Documentation">📖</a></td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->

152
install Executable file
View file

@ -0,0 +1,152 @@
#!/bin/env sh
# Script for installing ugit (git undo)
#
# This script can be executed via
# curl:
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
# or wget:
# sh -c "$(wget -qO- https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
# or httpie:
# sh -c "$(http --download https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
status_check() {
if command -v ugit 2>&1 > /dev/null; then
printf "\n\t%s\n" "You already have ${BOLD}ugit${RESET} installed."
printf "\n\t%s\n" "Run ${BOLD}git undo${RESET} everytime you make a git mistake :)"
exit 0
fi
}
installed() {
cmd=$(command -v "${1}")
return ${?}
}
die() {
>&2 echo "Fatal: $*"
exit 1
}
# TODO
# check if correct version of fzf is there
# check if correct version of git is there
# check if correct version of bash is there
check_dependencies() {
if ! command -v git > /dev/null 2>&1; then
printf "\n%s\n" "${BOLD}Can't work without git 😞. Please install git version >=2.30.0${RESET}"
exit 1
fi
if ! command -v fzf > /dev/null 2>&1; then
printf "\n%s\n" "${BOLD}Can't work without fzf 😞. Please install fzf version >=0.21.0${RESET}"
exit 1
fi
if ! command -v bash > /dev/null 2>&1; then
printf "\n%s\n" "${BOLD}Can't work without bash 😞. Please install bash version >=4${RESET}"
exit 1
fi
DEPS=""
DEPS="${DEPS} awk"
DEPS="${DEPS} xargs"
DEPS="${DEPS} cut"
DEPS="${DEPS} nl"
DEPS="${DEPS} tr"
for DEP in ${DEPS}; do
installed ${DEP} || die "Missing GNU Utility: '${DEP}'"
done
}
set_permissions(){
if [ -f ugit ] && ! chmod +x ugit; then
printf "\n%s\n" "Unknown error while installing ugit"
exit 1
fi
move_to_path
}
move_to_path(){
printf "%s\n" "We require some permissions to move ugit to /usr/bin"
if sudo mv ugit /usr/bin; then
sudo ln -s ugit /usr/bin/git-undo
else
printf "\n%s\n" "Unknown error while installing ugit"
exit 1
fi
}
download_ugit(){
UGIT_HOST="https://github.com/Bhupesh-V/ugit/releases/latest/download/ugit"
printf "\n%s\n" "Downloading ugit from ${BOLD}$UGIT_HOST${RESET} ..."
if curl -fsSL $UGIT_HOST -o ugit; then
set_permissions
else
printf "\n%s\n" "Unknown error while downloading ugit"
exit 1
fi
}
config_check() {
reflogExpire=$(git config --get gc.reflogExpire)
if [ "$reflogExpire" = "" ] ; then
printf "%s\n" "Setting ${BOLD}gc.reflogExpire${RESET} to 200 days"
if ! git config --global gc.reflogExpire 200; then
printf "%s\n" "Unexpected error while setting up gitconfig"
exit 1
fi
elif [ "$reflogExpire" -lt 200 ]; then
printf "%s\n" "ugit recommends increasing ${BOLD}gc.reflogExpire${RESET} config duration to 200 days."
fi
reflogExpireUnreachable=$(git config --get gc.reflogExpireUnreachable)
if [ "$reflogExpireUnreachable" = "" ]; then
printf "%s\n" "Setting ${BOLD}gc.reflogExpireUnreachable${RESET} to 90 days"
if ! git config --global gc.reflogExpireUnreachable 90; then
printf "%s\n" "Unexpected error while setting up gitconfig"
exit 1
fi
elif [ "$reflogExpireUnreachable" -lt 90 ]; then
printf "%s\n" "ugit recommends increasing ${BOLD}gc.reflogExpireUnreachable${RESET} config duration to 90 days."
fi
}
main () {
status_check
check_dependencies
download_ugit
config_check
printf "${BOLD}${ORANGE_FG}%s\n" ""
printf "%s\n" " _ _ "
printf "%s\n" " _ _ __ _(_| |_ "
printf "%s\n" "| | | |/ _\` | | __| "
printf "%s\n" "| |_| | (_| | | |_ "
printf "%s\n" " \__,_|\__, |_|\__| "
printf "%s\n" " |___/ "
printf "${RESET}\n%s" ""
printf "\t\t%s\n" ".... is now installed 👍"
printf "\n%s" "Run ${BOLD}ugit --help${RESET} for any help & assistance"
printf "\n%s\n" "Use ${BOLD}${ORANGE_FG}git undo${RESET} or ${BOLD}${ORANGE_FG}ugit${RESET} everytime you make a git mistake :)"
}
# check if tput exists
if ! command -v tput > /dev/null 2>&1; then
# tput could not be found :(
BOLD=""
RESET=""
ORANGE_FG=""
else
BOLD=$(tput bold)
RESET=$(tput sgr0)
ORANGE_FG=$(tput setaf 208)
fi
main

197
ugit
View file

@ -1,14 +1,15 @@
#!/usr/bin/env bash
# ugit: Undo your last git command without much effort. Powered by FZF
# ugit: Undo git commands with ease. Powered by FZF
set -uo pipefail;
SCRIPT_NAME="$0"
SCRIPT_URL="https://github.com/Bhupesh-V/ugit/releases/latest/download/ugit"
TMP_FILE="/tmp/ugit.sh"
VERSION="5.0"
VERSION="5.9"
pointer=""
BOLD_ORG_FG=$(tput bold)$(tput setaf 208)
BOLD=$(tput bold)
RESET=$(tput sgr0)
@ -33,10 +34,15 @@ display_menu() {
printf "%s\n" "Undo/Restore file to a previous commit"
printf "%s\n" "Undo ${BOLD_ORG_FG}git cherry-pick${RESET}"
printf "%s\n" "Undo all current uncommited changes"
printf "%s\n" "Undo ${BOLD_ORG_FG}git tag${RESET}"
printf "%s\n" "Undo ${BOLD_ORG_FG}git rm${RESET}"
}
perror() {
printf "%s\n" "$(tput bold)$(tput setaf 196)ugit error${RESET}: $1"
printf "%s\n" "If you think this is a Ugit bug, please follow this link to report it:"
printf "%s\n" "${BOLD_ORG_FG}https://github.com/Bhupesh-V/ugit/issues/new?template=bug-report.yml${RESET}"
exit
}
undo_git_commit() {
@ -52,14 +58,30 @@ undo_git_commit() {
[ -z "$commit" ] && exit
last_commit=$(git log --format="%h" -n 1)
initial_commit=$(git rev-list --max-parents=0 --abbrev-commit HEAD)
if [[ "$last_commit" == "$commit" ]]; then
if git reset HEAD~; then
# If the last commit is the same as the initial commit, delete reference to the branch(update-ref) and unstage changes of the initial commit(git rm).
# This will not delete the files from your working directory
if [[ "$last_commit" == "$initial_commit" ]]; then
if git update-ref -d HEAD && git rm --cached -rf . > /dev/null 2>&1; then
printf "%s\n" "Initial commit: $initial_commit successfully undone. Commit state is clean."
else
perror "Error: Failed to revert initial commit"
exit
fi
elif git reset HEAD~; then
printf "%s\n" "Commit: $last_commit successfully undone"
else
perror "Failed to revert commit $last_commit"
exit
fi
elif git revert "$commit"; then
printf "%s\n" "Commit: $commit successfully reverted. Check ${BOLD_ORG_FG}git status${RESET}"
else
perror "Error: unable to perfom operation"
fi
}
do_git_reset() {
@ -69,7 +91,7 @@ do_git_reset() {
# check if working tree is clean or not
[[ $(git status --porcelain 2>/dev/null) != "" ]] && read -p "You have uncommited changes, still proceed? [Y/n]: " -n 1 -r USER_INPUT
USER_INPUT=${USER_INPUT:-Y}
[[ "$USER_INPUT" == Y ]] && git reset --hard "$last_good_state"
[[ "$USER_INPUT" == Y ]] && git reset --hard "$last_good_state" || perror "Error: unable to perform reset operation"
}
undo_git_add() {
@ -81,6 +103,8 @@ undo_git_add() {
if [[ ${#choices[@]} -gt 0 ]] && git restore --staged "${choices[@]}"; then
printf "%s\n" "Done 👍️"
else
perror "Error: unable to perform operation"
fi
}
@ -89,8 +113,8 @@ change_commit_message() {
printf "%s" "Enter New Commit Message (Ctrl+d to save):"
msg=$(</dev/stdin)
echo
[[ "$msg" != "" ]] && git commit --amend -m "$msg" || perror "Empty Commit string!"
printf "%s\n" "Remember to run ${BOLD_ORG_FG}git push -f <remoteName> <branchName>${RESET} if this was a pushed commit"
[[ "$msg" != "" ]] && git commit --amend -m "$msg" && printf "%s\n" "Remember to run ${BOLD_ORG_FG}git push -f <remoteName> <branchName>${RESET} if this was a pushed commit" \
|| perror "Empty Commit string!"
}
undo_git_push() {
@ -98,6 +122,8 @@ undo_git_push() {
if git revert "$commit"; then
printf "%s\n" "Commit: $commit successfully reverted."
printf "%s\n" "Make sure to run ${BOLD_ORG_FG}git push${RESET} now!"
else
perror "Error: unable to perform operation"
fi
}
@ -110,7 +136,7 @@ undo_branch_delete() {
if [ -n "$BRANCH_NAME" ] && git checkout -b "$BRANCH_NAME" "$last_branch_commit"; then
printf "%s\n" "Branch $BRANCH_NAME successfully recovered 👍️"
else
perror "Error: unable to perform operation"
perror "Failed to recover branch $BRANCH_NAME"
fi
}
@ -118,6 +144,8 @@ undo_git_reset() {
LAST_GOOD_STATE=$(git reflog | fzf --ansi --height 20% --reverse --multi --header="Choose last known good commit" | awk '{print $1}')
if [[ -n "$LAST_GOOD_STATE" ]] && git reset "$LAST_GOOD_STATE"; then
printf "%s\n" "Reset to $LAST_GOOD_STATE 👍️"
else
perror "Unable to reset state"
fi
}
@ -135,7 +163,15 @@ undo_git_merge() {
[[ $(git status --porcelain 2>/dev/null) != "" ]] && read -p "You have uncommited changes, still proceed? [Y/n]: " -n 1 -r USER_INPUT
USER_INPUT=${USER_INPUT:-Y}
# ref: ORIG_HEAD points to the original commit from before the merge
[[ "$USER_INPUT" == Y ]] && git reset --merge ORIG_HEAD || exit 0
if [[ "$USER_INPUT" == Y ]]; then
if git reset --merge ORIG_HEAD; then
printf "Operation completed successfully"
else
perror "Unable to revert merge commit"
fi
else
exit
fi
# [[ "$USER_INPUT" == Y ]] && git reset --merge "$last_good_state" || exit 0
else
default_branch=$(git remote show origin | awk '/HEAD/ {print $3}')
@ -144,20 +180,27 @@ undo_git_merge() {
commit=$(git log --oneline | fzf --ansi --height 10% --reverse --header="Choose the merge commit" | awk '{print $1}')
if git revert -m 1 "$commit"; then
printf "%s\n" "Merge ($commit) successfully reverted 👍️"
else perror "Unable to revert merge commit"
fi
fi
}
recover_lost_stash() {
LOST_STASH=$(git fsck --no-progress --unreachable | \
awk '/commit/ {print $3}' | \
xargs git log --color --oneline --merges --no-walk | \
fzf --ansi --height 20% --reverse --header="Choose commit associated with stash" | awk '{print $1}'
LOST_STASH=$(git fsck --no-progress --unreachable |
awk '/commit/ {print $3}' |
xargs git log --color --oneline --merges --no-walk
)
[[ "$LOST_STASH" ]] && read -p "Enter Stash Description: " -r STASH_MSG || exit
if [ -z "$LOST_STASH" ]; then
printf "%s\n" "No unreachable commits found. Exiting..."
exit
fi
if git update-ref refs/stash "$LOST_STASH" --create-reflog -m "$STASH_MSG"; then
STASH=$(echo "$LOST_STASH" | fzf --ansi --height 20% --reverse --header="Choose commit associated with stash" | awk '{print $1}')
read -p "Enter Stash Description: " -r STASH_MSG
if git update-ref refs/stash "$STASH" --create-reflog -m "$STASH_MSG"; then
printf "%s\n" "Stash Successfully Recovered 👍️"
else
perror "Unable to recover stash"
@ -203,11 +246,22 @@ recover_deleted_tag() {
undo_file_delete() {
if [[ "$1" = "uncommited" ]]; then
# user didn't commit the file deletion
DELETED_FILE=$(git ls-files -d | fzf --ansi --height 20% --reverse --header="Choose deleted file to recover" | awk '{print $1}')
if git checkout HEAD "$DELETED_FILE"; then
printf "%s\n" "${BOLD}$DELETED_FILE${RESET} Successfully Recovered 👍️"
readarray -t DELETED_FILES < <(
git ls-files -d |
fzf --ansi --height 20% --reverse --header="Choose deleted files to recover" --multi |
awk '{print $1}'
)
if [ ${#DELETED_FILES[@]} -eq 0 ]; then
exit 0
fi
if git checkout HEAD -- "${DELETED_FILES[@]}"; then
printf "%s\n" "${BOLD}${DELETED_FILES[*]}${RESET}"
printf "%s\n" "Successfully Recovered ${#DELETED_FILES[@]} file(s)"
else
perror "Unable to recover ${BOLD}${DELETED_FILES[*]}${RESET}"
fi
elif [[ "$1" = "commited" ]]; then
read -p "Enter complete filename: " -r FILENAME
COMMIT=$(git log --color --diff-filter=D --oneline | fzf --ansi --height 50% \
@ -221,6 +275,8 @@ undo_file_delete() {
if git checkout "$COMMIT"~1 -- "$FILENAME"; then
printf "%s\n" "${BOLD}$FILENAME${RESET} Successfully Recovered 👍️"
else
perror "Unable to recover ${BOLD}$FILENAME${RESET}"
fi
fi
}
@ -246,6 +302,8 @@ restore_file() {
exit 0
elif [[ "$COMMIT" != "" && "$FILE" != "" ]] && git restore --source="$COMMIT" "$FILE"; then
printf "%s\n" "$FILE restored to version at ${BOLD}$COMMIT${RESET}"
else
perror "Error: unable to perform operation"
fi
}
@ -263,6 +321,54 @@ undo_all() {
# printf "%s\n" "Note: Stashing untracked files might take some time, hold on"
printf "%s\n" "Cleared all changes 👍️"
printf "%s\n" "Run ${BOLD_ORG_FG}git stash apply${RESET} to redo changes or ${BOLD_ORG_FG}git stash drop${RESET} to remove them"
else
perror "Error: unable to perform operation"
fi
}
undo_git_tag() {
# Fetch all tags from remote
if git fetch --all --tags > /dev/null 2>&1; then
printf "\nFetching tags from remote"
else
perror "Unable to fetch tags from remote.Please check repository access."
exit
fi
tag=$(git tag --sort=v:refname | fzf --ansi --height 80% \
--reverse --multi --header="Choose a tag to remove" \
--preview "echo {} | cut -d' ' -f1 | xargs -I{} git show --color --pretty=format:%b {}" \
--bind 'j:down,k:up,ctrl-j:preview-down,ctrl-k:preview-up,ctrl-space:toggle-preview' --preview-window right:60% )
# Exit if no tag is selected
[ -z "$tag" ] && exit
read -p "${BOLD_ORG_FG}Warning:${RESET} Undoing a git tag will remove the tag from both your local repository as well as the remote origin. Do you want to continue [Y/n]?" -n 1 -r USER_INPUT
USER_INPUT=${USER_INPUT:-y}
# Delete git tag
if [[ "$USER_INPUT" == Y || "$USER_INPUT" == y ]] && printf "%s\nDeleting tag: $tag"; then
if git tag -d "$tag" > /dev/null 2>&1; then
git push origin --delete "$tag" > /dev/null 2>&1
printf "%s\n\nTag $tag deleted 👍️\n"
else
perror "Failed to delete tag."
fi
else
exit
fi
}
undo_git_rm(){
# Find all the deleted files from git history
filepath=$(git log --diff-filter=D --summary | grep delete | nl -n ln | fzf --header="Choose the file to restore" --height 50% --ansi --reverse "$pointer" --cycle | awk '{print $5}')
# Find the commit hash value of the selected filepath
commit=$(git log -- "$filepath"| awk 'NR==1{print $2}')
# Restore the file
if git checkout "$commit"^ "$filepath"; then
printf "%s\n" "File $filepath restored successfully."
else
perror "Unable to restore Fie $filepath"
fi
}
@ -287,6 +393,8 @@ ugit_menu() {
17) restore_file;;
18) undo_git_commit;;
19) undo_all;;
20) undo_git_tag;;
21) undo_git_rm;;
esac
}
@ -311,6 +419,12 @@ check_deps() {
for dep in "${deps[@]}"; do
installed "${dep}" || die "Missing dependency: '${dep}'"
done
# if version of fzf < 0.21, do not use --pointer
fzf_version=$(fzf --version | cut -d "." -f 1,2 | tr -d '.()[:alpha:]')
if test "$fzf_version" -ge 021; then
pointer="--pointer=👉"
fi
}
show_version() {
@ -318,33 +432,33 @@ show_version() {
}
print_help() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-u] [-g]
ugit helps you undo git commands without much effort
Just run 'ugit' and search for what you want to undo
Available options:
-h, --help Print this help and exit
-v, --version Print current ugit version
-u, --update Update ugit
-g, --guide Open ugit undo text guide
EOF
printf "\n%s\n" "Contact 📬️: $(tput bold)varshneybhupesh@gmail.com${RESET} for assistance"
printf "%s\n" "Read the guide: https://bhupesh.gitbook.io/notes/git/how-to-undo-anything-in-git"
printf "\n%s\n" "Please give us ⭐ a if you liked ugit ${BOLD_ORG_FG}https://github.com/Bhupesh-V/ugit${RESET}"
printf "Usage: %s [-h] [-v] [-u] [-g]\n" "ugit"
printf "ugit helps you undo git commands without much effort\n"
printf "Just run 'ugit' and search for what you want to undo\n\n"
printf "Available options:\n"
printf " -h, --help Print this help and exit\n"
printf " -v, --version Print current ugit version\n"
printf " -u, --update Update ugit\n"
printf " -g, --guide Open the ugit undo text guide\n\n"
printf "Contact 📬️: %s for assistance\n" "$(tput bold)varshneybhupesh@gmail.com${RESET}"
printf "Read the guide: %s\n" "https://til.bhupesh.me/git/how-to-undo-anything-in-git"
printf "Please give us a ⭐ if you liked ugit %s\n" "${BOLD_ORG_FG}https://github.com/Bhupesh-V/ugit${RESET}"
}
get_changelog() {
# get changelog/release notes for the most recent release
REMOTE_REPO="Bhupesh-V/ugit"
CHANGELOG=$(curl -s -L https://api.github.com/repos/$REMOTE_REPO/releases | awk -F=":" '/body/ {print $1;exit}' | cut -d ':' -f 2 | tr -d "\"")
printf "%s\n" "${BOLD}Changelog:${RESET}"
echo -e "${CHANGELOG#* }"
CHANGELOG=$(curl -s -L https://api.github.com/repos/$REMOTE_REPO/releases | awk -F=":" '/html_url/ {print $1;exit}' | cut -d ':' -f 2,3 | tr -d "\", ")
printf "Read Full Changelog: %s\n" "${BOLD}${CHANGELOG}${RESET}"
}
ugit_update() {
if [ -n "${UGIT_RUNNING_IN_DOCKER-}" ] && [ "$UGIT_RUNNING_IN_DOCKER" = true ]; then
printf "%s\n\n" "You are running version ${VERSION} of ugit via Docker. Please pull the latest docker image to update."
printf "\t%s\n" "${BOLD_ORG_FG}docker pull bhupeshimself/ugit${RESET}"
return
fi
printf "%s\n" "Checking for updates ..."
curl -s -L "$SCRIPT_URL" > "$TMP_FILE"
NEW_VER=$(grep "^VERSION" "$TMP_FILE" | awk -F'[="]' '{print $3}')
@ -364,7 +478,12 @@ ugit_update() {
}
open_guide() {
GUIDE="https://bhupesh.gitbook.io/notes/git/how-to-undo-anything-in-git"
GUIDE="https://til.bhupesh.me/git/how-to-undo-anything-in-git"
if [ -n "${UGIT_RUNNING_IN_DOCKER-}" ] && [ "$UGIT_RUNNING_IN_DOCKER" = true ]; then
printf "%s\n" "You can find how ugit does its magic at: ${BOLD_ORG_FG}${GUIDE}${RESET}"
return
fi
case "$OSTYPE" in
darwin*)
@ -394,7 +513,7 @@ init_test() {
# test if user is in a git directory or not
if git rev-parse --git-dir > /dev/null 2>&1; then
# check if the current working directory is top level or not
[ "$(pwd)" != "$(git rev-parse --show-toplevel)" ] && printf "ugit: %s\n" "Not inside top level dir $(git rev-parse --show-toplevel)"
[ "" != "$(git rev-parse --show-cdup)" ] && printf "ugit: %s\n" "Not inside top level dir $(git rev-parse --show-toplevel)"
else
printf "%s\n" "Ummm, you are not inside a Git repo 😟"
exit
@ -422,7 +541,7 @@ main() {
check_deps
init_test
header
option=$(display_menu | nl -n ln | fzf --header="Don't worry we all mess up sometimes" --height 50% --ansi --reverse --pointer='👉' --cycle | awk '{print $1}')
option=$(display_menu | nl -n ln | fzf --header="Don't worry we all mess up sometimes" --height 50% --ansi --reverse "$pointer" --cycle | awk '{print $1}')
ugit_menu
fi
}

2
ugit-flatpak/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.flatpak-builder
build-dir

View file

@ -0,0 +1,45 @@
app-id: org.Bhupesh-V.ugit
runtime: org.freedesktop.Platform
runtime-version: '21.08'
sdk: org.freedesktop.Sdk
command: ugit
finish-args:
- --filesystem=home:rw
- --share=network
modules:
- name: fzf
buildsystem: simple
build-commands:
- tar -xvf fzf-0.33.0-linux_amd64.tar.gz
- install -Dm755 fzf ${FLATPAK_DEST}/bin/fzf
sources:
- type: file
url: https://github.com/junegunn/fzf/releases/download/0.33.0/fzf-0.33.0-linux_amd64.tar.gz
sha256: bcf2f4ba957cce15cea1546f48cdd3bfe9b5dc9a6e80ccc400314bda171466f3
- name: git
buildsystem: simple
build-commands:
- install -Dm755 $(which git) ${FLATPAK_DEST}/bin/
- install -Dm755 $(which git-cvsserver) ${FLATPAK_DEST}/bin/
- install -Dm755 $(which git-receive-pack) ${FLATPAK_DEST}/bin/
- install -Dm755 $(which git-shell) ${FLATPAK_DEST}/bin/
- install -Dm755 $(which git-upload-archive) ${FLATPAK_DEST}/bin/
- install -Dm755 $(which git-upload-pack) ${FLATPAK_DEST}/bin/
- name: ugit
buildsystem: simple
build-options:
build-commands:
- chmod +x ugit
- install -Dm755 ugit ${FLATPAK_DEST}/bin/ugit
- install -Dm755 org.Bhupesh-V.ugit.desktop ${FLATPAK_DEST}/share/applications/org.Bhupesh-V.ugit.desktop
sources:
- type: git
url: https://github.com/Bhupesh-V/ugit
tag: v5.3
commit: 14da50780e696e758bf362489496b74901f84cc1
- type: file
path: org.Bhupesh-V.ugit.desktop

View file

@ -0,0 +1,5 @@
[Desktop Entry]
Name=ugit
Exec=ugit
Type=Application
Terminal=true