Skip to content

Instantly share code, notes, and snippets.

View dizzersee's full-sized avatar
𝓉𝒽𝑒𝓇𝑒'𝓈 𝒸𝑜𝒻𝒻𝑒𝑒 𝒾𝓃 𝓉𝒽𝒶𝓉 𝓃𝑒𝒷𝓊𝓁𝒶

Alexandra Axt dizzersee

𝓉𝒽𝑒𝓇𝑒'𝓈 𝒸𝑜𝒻𝒻𝑒𝑒 𝒾𝓃 𝓉𝒽𝒶𝓉 𝓃𝑒𝒷𝓊𝓁𝒶
  • Germany
View GitHub Profile
@dizzersee
dizzersee / Git rename branch
Created December 7, 2019 12:22
Git rename branch
Locally:
```
git checkout oldname
git branch -m "newname"
git push origin :oldname newname
git push origin -u newname
```
In remote:
First create or update .gitignore File locally and run
`git rm --cached -r .`
`git add -A`
`git commit -m "Add gitignore"`
`git push`
Now on remote first upload the new gitfile **maually** and then run
`git rm --cached -r .`
@dizzersee
dizzersee / Git pull dry run
Last active November 18, 2019 00:17
Git pull dry run
# Dry run
git fetch origin master
git diff --name-status HEAD..origin/master
# Finally merge
git merge origin/master
@dizzersee
dizzersee / gist:6e16aed58a5909178f1bbc36de643c74
Created November 17, 2019 23:35
rm all files but gitignore
find . -type f ! -iname ".gitignore" -delete
find . -empty -type d -delete
@dizzersee
dizzersee / Regex
Last active October 21, 2019 17:10
Regex that matches a URL until a specific sequence appears
https\:\/\/(www.)?(domain.com\/?)\S*?(?=((\<br)|(\(\()| |$))
Test https://www.regextester.com/
======== REGEX ========
\S*?
- ? is Lazy operator: Match as few characters as possible
(?=((\<br)|(\(\()| |$))
@dizzersee
dizzersee / command
Last active October 16, 2019 13:39
Move biggest files to another dir
##### Some linux commands to move biggest files
# Move 6 biggest files of current dir to "bigfiles" dir
ls --sort=size | head -n 6 | xargs -I{} cp {} ../bigfiles
# Only files with filename length of 14: