So, I was wondering if there was a way to write a batch file that opens git bash inside the cmd window and called on certain git functions, pretty much like a macro. Is it possible to do this? I know that I can call "C:\Program Files (x86)\Git\bin\sh.exe --login -i" inside a cmd window to run git bash inside the window, and I've managed to do that with a batch file, but then it doesn't do anything until sh.exe's process ends.
Is this possible? How can I do this?
Note: I have found this: Reading Git commands using Batch(.BAT) file. The guy said this:
Hai All, Finally I got the solution for my question.By using below code ssippet, we can run the Git using BAT file
"c:\Program Files\Git\cmd\git.cmd" pull > c:\platform.txt"
vthe above code using from BAT file instead of using git pull or git push and any git command using GIT Bash. Thanks to all for posting your valuable comments and partial answer
But for me there is no git.cmd executable... and I would only use writing to a .txt file if a merge went wrong or something... however there is a git.exe executable in Git/bin. Apparently it Will let me do all the git functions, like add, push, commit, merge, etc. So I have two questions about it: Will I have to have the batch file change directories to the local repo and then call git.exe from there? Because it won't let me do git cd
. Also, say that I typed in git fetch upstream
inside a cmd window. If I type git merge upstream/master
, then will it remember what it had fetch previously?