Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.
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
16 changes: 16 additions & 0 deletions contrib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Installing on Windows
=====================

1. git clone --recursive https://github.com/DarinMacRae/gitflow.git
2. Open a command prompt with Administrative privilege
(Don't use Powershell)
3. cd into gitflow\contrib
4. ensure that GIT_HOME is pointing to the installation folder of Git
e.g.
set GIT_HOME=C:\Users\<user>\AppData\Local\Programs\Git\cmd
set GIT_HOME=C:\Program Files\Git\usr\bin

5. Run msysgit-install

Note, that it works with installations of Git other than MSysGit.

14 changes: 7 additions & 7 deletions contrib/msysgit-install.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ call :ChkGetopt getopt.exe || set ERR=1
if %ERR%==1 goto :End
echo getopt.exe... Found

if not exist "%GIT_HOME%\bin\git-flow" goto :Install
echo GitFlow is already installed.>&2
if not exist "%GIT_HOME%\git-hf" goto :Install
echo HubFlow is already installed.>&2
set /p mychoice="Do you want to replace it [y/n]"
if "%mychoice%"=="y" goto :DeleteOldFiles
goto :Abort

:DeleteOldFiles
echo Deleting old files...
for /F %%i in ("%GIT_HOME%\git-flow*" "%GIT_HOME%\gitflow-*") do if exist "%%~fi" del /F /Q "%%~fi"
for /F %%i in ("%GIT_HOME%\git-hf*" "%GIT_HOME%\git-hf-*" "%GIT_HOME%\hubflow-*") do if exist "%%~fi" del /F /Q "%%~fi"

:Install
echo Copying files...
::goto :EOF
xcopy "%~dp0\..\git-flow" "%GIT_HOME%\bin" /Y /R /F
xcopy "%~dp0\..\git-hf" "%GIT_HOME%" /Y /R /F
if errorlevel 4 if not errorlevel 5 goto :AccessDenied
if errorlevel 1 set ERR=1
xcopy "%~dp0\..\git-flow*" "%GIT_HOME%\bin" /Y /R /F || set ERR=1
xcopy "%~dp0\..\gitflow-*" "%GIT_HOME%\bin" /Y /R /F || set ERR=1
xcopy "%~dp0\..\shFlags\src\shflags" "%GIT_HOME%\bin\gitflow-shFlags" /Y /R /F || set ERR=1
xcopy "%~dp0\..\git-hf*" "%GIT_HOME%" /Y /R /F || set ERR=1
xcopy "%~dp0\..\hubflow-*" "%GIT_HOME%" /Y /R /F || set ERR=1
xcopy "%~dp0\..\shFlags\src\shflags" "%GIT_HOME%\hubflow-shFlags" /Y /R /F || set ERR=1

if %ERR%==1 choice /T 30 /C Y /D Y /M "Some unexpected errors happened. Sorry, you'll have to fix them by yourself."

Expand Down
12 changes: 6 additions & 6 deletions git-hf-feature
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,15 @@ cmd_checkout() {
#
# - https://github.com/bmomberger-reciprocity
# - https://github.com/jhofmeyr

# does the feature already exist?
if git_local_branch_exists "$BRANCH" ; then
# does the feature already exist?
if git_local_branch_exists "$FEATURE_BRANCH" ; then
# we have a local branch - use that
hubflow_change_branch "$BRANCH"
elif git_remote_branch_exists "$ORIGIN/$BRANCH" ; then
hubflow_change_branch "$FEATURE_BRANCH"
elif git_remote_branch_exists "$ORIGIN/$FEATURE_BRANCH" ; then
# we have a remote branch - create a local feature branch based
# on the remote branch
git checkout -b "$BRANCH" --track "$ORIGIN/$BRANCH"
git checkout -b "$FEATURE_BRANCH" --track "$ORIGIN/$FEATURE_BRANCH"
else
# the user is really trying to start a new feature
#
Expand Down
14 changes: 10 additions & 4 deletions hubflow-common
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ hubflow_change_branch() {
}

hubflow_branch_push() {
# make sure we have something to push onto the stack
if [[ -z $1 ]] ; then
die "*** internal error: attempt to push empty item onto the stack"
fi

# make sure we have a stack to push onto
if [[ -z BRANCH_STACK ]] ; then
BRANCH_STACK=()
Expand All @@ -285,10 +290,11 @@ hubflow_branch_pop() {
# make sure the stack is not empty
[[ $BRANCH_STACK_SP != 0 ]] || die "Internal error: attempt to pop from empty BRANCH_STACK"

# pop the branch from the stack
local popped_branch=${BRANCH_STACK[$BRANCH_STACK_SP]}
BRANCH_STACK[$BRANCH_STACK_SP]=
let "BRANCH_STACK_SP -= 1"
# pop the branch from the stack
local tmp_branch_sp=$BRANCH_STACK_SP
let "BRANCH_STACK_SP -= 1"
local popped_branch=${BRANCH_STACK[$BRANCH_STACK_SP]}
unset BRANCH_STACK[$tmp_branch_sp]

# do we need to switch branch too?
hubflow_change_branch "$popped_branch"
Expand Down