Skip to content

Instantly share code, notes, and snippets.

@gringoh
gringoh / git-undo-commit.md
Created May 8, 2020 11:39
[git: Undo commit not pushed] #git
@gringoh
gringoh / pod-update.sh
Created May 8, 2020 11:47
[pod: update pods] #ios #cocoapods
pod update && pod install
@gringoh
gringoh / mvn-run-spring-boot.sh
Created May 8, 2020 11:48
[mvn: Run Spring Boot Project] #mvn #spring
mvn spring-boot:run
@gringoh
gringoh / git-move-commits.md
Created May 13, 2020 14:06
[git: Move commits to another branch] #git

Moving to an existing branch

If you want to move your commits to an existing branch, it will look like this:

git checkout existingbranch
git merge master         # Bring the commits here
git checkout master
git reset --keep HEAD~3  # Move master back by 3 commits.
git checkout existingbranch

The --keep option preserves any uncommitted changes that you might have in unrelated files, or aborts if those changes would have to be overwritten -- similarly to what git checkout does. If it aborts, git stash your changes and retry, or use --hard to lose the changes (even from files that didn't change between the commits!)

@gringoh
gringoh / bash-delete-dot-files-recursively.sh
Last active May 13, 2020 15:21
[bash: Delete dot files recursively] #bash
find . -name ".*" -print
# I don't know the MAC OS, but that is how you find them all in most *nix environments.
find . -name ".*" -exec rm -rf {} \;
# to get rid of them... do the first find and make sure that list is what you want before you delete them all.
# The first "." means from your current directory. Also note the second ".*" can be changed to ".svn*" or any other more specific name; the syntax above just finds all hidden files, but you can be more selective. I use this all the time to remove all of the .svn directories in old code.
@gringoh
gringoh / git-username-and-email.md
Last active May 10, 2022 18:57
[Git: change user and mail] #git

Change git username and email

To set your global username/email configuration

git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "[email protected]"

To set repository-specific username/email configuration:

@gringoh
gringoh / git-stash-unstaged-changes.md
Last active May 12, 2021 13:39
[Git: Stash unstaged changes] #git

Git: Stash unstaged changes

This will stash all modifications that you did not git add:

git stash -k

Note that newly created (and non-added) files will remain in your working directory unless you also use the -u switch.

git stash -k -u
@gringoh
gringoh / git-remove-files-gitignore.md
Last active July 1, 2022 12:28
[Git: Remove files after updating .gitignore] #git

Git: Remove files after updating .gitignore

Here, we're removing all files that are currently being ignored in .gitignore:

git rm -r --cached .
git add .
git commit -m "Removes all .gitignore files and folders"
@gringoh
gringoh / flutter-create.md
Last active June 22, 2021 15:58
[Flutter: Create project, library or plugin] #flutter

Flutter: Create project, library or plugin

  • create project
flutter create --org com.example.project.name  --androidx -i swift -a kotlin --description 'Description goes here' flutter_project_name
  • create library/package
flutter create --org com.example.package.name  --description 'Description goes here' --template=package flutter_package_name
  • create plugin
@gringoh
gringoh / dart-create.md
Last active July 25, 2022 16:08
[Dart: Create project] #dart

Dart: Create project

dart create -t console-simple project_name

Available templates:

  • console-simple: A simple command-line application. (default)
  • console-full: A command-line application sample.
  • package-simple: A starting point for Dart libraries or applications.
  • web-simple: A web app that uses only core Dart libraries.