git-bash

RegExp: Last occurence of pattern that occurs before another pattern

拥有回忆 提交于 2019-12-19 10:47:40
问题 I want to take a text pattern that occurs the last before another text pattern. For example I have this text: code 4ab6-7b5 Another lorem ipsum Random commentary. code f6ee-304 Lorem ipsum text Dummy text code: ebf6-649 Other random text id-x: 7662dd41-29b5-9646-a4bc-1f6e16e8095e code: abcd-ebf Random text id-x: 7662dd41-29b5-9646-a4bc-1f6e16e8095e I want to take the last code that occurs before the first occurrence of id-x (which means I want to get code ebf6-649 ) How can I do that with

RegExp: Last occurence of pattern that occurs before another pattern

别等时光非礼了梦想. 提交于 2019-12-19 10:47:15
问题 I want to take a text pattern that occurs the last before another text pattern. For example I have this text: code 4ab6-7b5 Another lorem ipsum Random commentary. code f6ee-304 Lorem ipsum text Dummy text code: ebf6-649 Other random text id-x: 7662dd41-29b5-9646-a4bc-1f6e16e8095e code: abcd-ebf Random text id-x: 7662dd41-29b5-9646-a4bc-1f6e16e8095e I want to take the last code that occurs before the first occurrence of id-x (which means I want to get code ebf6-649 ) How can I do that with

How to set the correct local time zone in git bash?

一笑奈何 提交于 2019-12-19 08:52:00
问题 I am using git-bash on a Windows system. The Windows clock shows local time, but inside git-bash everything is in GMT time: $ date Mon Mar 31 16:08:57 GMT 2014 Also setting TZ will not change things: $ TZ="Europe/Berlin" date Mon Mar 31 16:09:01 GMT 2014 Similarly all times it git log are GMT only. Is there a way to set the correct timezone in git-bash? 回答1: On Windows the TZ variable seems to work differently. To get the German timezone you have to write: TZ=GST-1GDT date If you set it to

git cleanup old branches

帅比萌擦擦* 提交于 2019-12-19 08:30:42
问题 I'd like to create a git command that will delete any branches that have all commits included in the current branch e.g. $ git branch groups * master $ git cleanup-branches deleted groups # all commits are included in master $ git branch * master How would I go about creating this? 回答1: You can leverage git branch -d here, as it won't delete any branch not yet merged into your current branch: git config --global alias.cleanup-branches \ '!git branch | grep -v "\*" | awk "{ print $1 }" | xargs

.bash_history does not update in Git for Windows (git bash)

大兔子大兔子 提交于 2019-12-18 11:07:21
问题 I am using Git for Windows (ver. 1.7.8-preview20111206) and even though I have a .bash_history file in my HOME folder, it never automatically gets updated. When I start Git Bash, I can see in the history commands that I manually added to the .bash_history file, but it does not get updated automatically. I used the shopt -s histappend command to make sure that the history gets saved every time I close the shell, but it does not work. If I manually use the history -w command, then my file gets

How to Not Overwrite Previous Terminal Contents

会有一股神秘感。 提交于 2019-12-18 09:24:18
问题 I'm not sure if this is a duplicate, but I have no clue what to search for if it is, as I don't know the name for this phenomenon. Basically, whenever I use vim and less on certain computers, the previous terminal contents are overwritten by the buffer of the current file (I think). If I scroll back with the scrollbar, rather than the current program's commands, I can see the previous terminal contents, but some of the previous lines have been written over by the current program. It seems

Updating file permissions with git-bash on Windows 7

江枫思渺然 提交于 2019-12-17 22:45:29
问题 How do I update file permissions with git-bash on Windows 7? I've tried the following without success: $ ls -al scripts/script.sh -rw-r--r-- 1 myUid Administ 70 Sep 8 11:24 scripts/script.sh $ git update-index --chmod=+x scripts/script.sh $ ls -al scripts/script.sh -rw-r--r-- 1 myUid Administ 70 Sep 8 11:24 scripts/script.sh $ chmod +x scripts/script.sh $ ls -al scripts/script.sh -rw-r--r-- 1 myUid Administ 70 Sep 8 11:24 scripts/script.sh 回答1: You are probably using NTFS or FAT32 on Windows,

How do I launch a Git Bash window with particular working directory using a script?

萝らか妹 提交于 2019-12-17 21:40:55
问题 How can I launch a new Git Bash window with a specified working directory using a script (either Bash or Windows batch)? My goal is to launch multiple Git Bash windows from a single script, each set to a different working directory. This way I can quickly get to work after booting the computer instead of having to open Git Bash windows and navigating each one to the correct working directory. I am not asking how to change the default working directory, like this question does, but to launch

Can't run python in git terminal?

跟風遠走 提交于 2019-12-17 21:16:08
问题 I have python 3.6 installed on my Win7 system and am trying to get it working in the git bash (MINGW64), so far to no avail. I've added the install directory (NOT the .exe, of course) to PATH, with no results. Even if I directly cd to the install directory, it doesn't see it. $ python bash: python: command not found $ echo $PATH /c/Users/Aerovistae/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Aerovistae/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32

Bash in Git for Windows: Weirdness when running a command with CMD.exe /C with args

僤鯓⒐⒋嵵緔 提交于 2019-12-17 17:55:13
问题 This is more of an annoyance rather than a problem but I would very much like to understand the semantics here. All I want to do is to run an arbitrary command on a temporary command-prompt session which itself running under a bash session. My success rate is 50/50 as some command works as expected whereas others not so much. I think the problem may lie around arguments not lining up properly (i.e. missing or merged arguments) I'll try to explain what I mean by weird by a series of commands