Skip to content
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "patchport",
"version": "1.0.0",
"version": "1.0.1",
"description": "a deployment and development environment management utility",
"main": "index.js",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function run() {
}

// No commit ID provided, display git log for selection
commitId = await GitHelpers.selectCommitFromLog()
commitId = await GitHelpers.selectCommitFromLog(originBranch)
if (!commitId) {
console.error('No commit selected. Exiting.')
process.exit(1)
Expand Down
5 changes: 4 additions & 1 deletion src/utils/gitHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ async function promptForOriginBranch(): Promise<ValidBranchName> {
return originBranch
}

export async function selectCommitFromLog(): Promise<string | null> {
export async function selectCommitFromLog(
branchName: string
): Promise<string | null> {
console.log('')
const git: SimpleGit = simpleGit()
try {
// Fetch the latest commits from the current branch
await git.pull('origin', branchName)
const log = await git.log({ maxCount: 20 })

if (log.all.length === 0) {
Expand Down