Skip to content

Commit 041ab7a

Browse files
committed
feat(undoMerge) complete
1 parent d9b54da commit 041ab7a

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

components/DropDownOther.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ const dropDown = ({ refreshTab, accentColor, defaultColor }) => {
2525
label: 'Stash Changes',
2626
value: 'stashChanges'
2727
},
28+
{
29+
label: 'Undo Stash',
30+
value: 'undoStash'
31+
},
2832
{
2933
label: 'Undo Merge',
3034
value: 'undoMerge'

components/MergeRevert.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
11
const React = require('react')
2+
const { useState } = require("react");
23
const { Box, Text, NewLine } = require('ink')
34
const { execSync, exec } =require("child_process")
45
const TextInput = require("ink-text-input").default;
56

67
const MergeRevert = (props) => {
78
const [commitId, setCommitId] = useState("");
89

10+
let { refreshTab } = props;
911

1012
//reverts merge based on git log merge-id
1113
let singleBranch = execSync(
14+
//most recent commit id
1215
'git log --all --decorate --oneline --graph'
1316
).toString().split('\n', 1)
14-
// let branchRevert = execSync(
15-
// `git git revert -m 1 {}`
16-
// )
17+
const branchRevert = () => {
18+
//reverts commit
19+
try {
20+
execSync(`git revert -m 1 ${commitId}`)
21+
} catch (error) {
22+
console.error('Oops, something went wrong.')
23+
}
24+
}
1725
return (
1826
<Box flexDirection='column'>
1927
<Box><Text> </Text></Box>
20-
<Box><Text> Please be on master branch. </Text></Box>
28+
{/* <Box><Text> Please be on master branch. </Text></Box> */}
29+
<Box><Text color='redBright'> THIS WILL DELETE ALL FILES/CHANGES MADE IN THIS COMMIT </Text></Box>
2130
<Box flexDirection='row'>
2231
<Text> Latest Commit Id: </Text>
2332
<Text color='#f09e8c'>{singleBranch}</Text>
2433
</Box>
2534
<Box flexDirection='row'>
26-
<Text> Please enter your desired commit Id: </Text>
35+
<Text> Please enter your commit Id: </Text>
2736
<TextInput
2837
value={commitId}
2938
onChange={setCommitId}

styleFile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ module.exports = {
99
accentColor: 'red', // accepted values include ['red', 'blue', 'white', 'green', etc.]
1010

1111
// setting to determine whether app dynamically adjusts to screen resizing; setting to false may improve performance
12-
appResize: true, // acepted values include [true, false]
12+
appResize: false, // acepted values include [true, false]
1313
}

0 commit comments

Comments
 (0)