2016-04-16 52 views
1

由於git hub無法關閉提交消息中的自動url鏈接,我想要一種方法來刪除/修剪文件「。」。來自url提交消息。從git提交修剪網址

http://www.somesite.com/ -> "http://www.somesite com/" 
http://somesite.co.uk/ -> "http://somesite.co uk/" 
http://somesite.eu/ -> "http://somesite eu/" 
http://somesite.eu:8080/ -> "http://somesite eu:8080/" 
etc 

這是我非常基本的commit腳本./script.sh 「」

#!/bin/bash 
git pull origin master 
git commit -a -m "$1" 
git push origin master 

回答

0

對於更換您的空間中提到的點做

#!/bin/bash 
git pull origin master 
git commit -a -m "$(echo "$1" | sed "s!\.\([^./]*\(/\|$\)\)! \1!")" 
git push origin master 

對於之前剛剛插入空格同樣的點做

#!/bin/bash 
git pull origin master 
git commit -a -m "$(echo "$1" | sed "s|\.[^./]*\(/\|$\)| \0|")" 
git push origin master 
+0

這看起來不錯(u sed最高建議)。如果您在網址的末尾放置「/」。 「http://somesite.com」它似乎解析的網址,無論如何周圍呢? –

+0

驚訝我不是唯一一個在github中解析url的問題。我希望它可以關閉。 –

+0

啊,右鍵更新了答案。 URL解析有什麼問題,它有什麼不好? – Vampire