Skip to content

Instantly share code, notes, and snippets.

@giljr
Last active May 14, 2024 17:10
Show Gist options
  • Save giljr/d34bc924a7da937b2c3191c4f99d0e81 to your computer and use it in GitHub Desktop.
Save giljr/d34bc924a7da937b2c3191c4f99d0e81 to your computer and use it in GitHub Desktop.
git hints
UNWNATED COMMITS - Deleting multiple latest commits
git reset --hard <sha1-commit-hash>
git push origin HEAD --force
Breno Diogenes Fernandes
git reset --hard HEAD~1
HEROKU
INIT REPO:
git init
git status
git add -A
git remote add origin https://github.com/giljr/photo-blog.git
or
git init
git status
git add -A
git commit -m ":tada: Initial Commit"
git remote add origin [email protected]:giljr/hotwire_rails_tutorial.git
git remote -v
git branch --list
git checkout -b master
git branch -M master
git push --set-upstream origin master
git tag -a Hotwire_v1 -m "Turbo Tech - How it Works! Go to https://hotwired.dev/" -m "0- Set up CHAT app - vanilla rails 7;" -m "Thank you for downloading this project ๐Ÿ˜˜๏ธ๐Ÿ‘Œ๏ธ๐Ÿ‘‹๏ธ๐Ÿ˜๏ธ"
git push origin Hotwire_v1
UPLOAD TO HEROKU:
heroku create
heroku rename j3-photo-blog-app
git remote -v
rails s
git commit -m ":tada: Initial Commit"
git push -u origin master
git push heroku master
heroku stack:set heroku-20
git push heroku master
RUNNING HEROKU MIGRATIONS:
heroku run rails db:migrate
heroku open
MONITORING STREAM HEROKU:
heroku logs --tail
CHECKING ACCOUNTS:
heroku ps
heroku addons:add sendgrid:free
DESENV - BRANCH FEATURES:
git checkout -b dev_1
git branch --list
GET RID OF FEATURES DEV_1:
git branch -d chekout dev_1
MERGE 2 MASTER FEATURES DEV_2:
git checkout -b dev_2
git branch --list
git checkout master
git merge dev_2
RAILS NEW PROJECT:
OPEN A NEW_DIR@BASH: mkdir ror
git clone https://github.com/giljr/photo-blog.git
bundle install --without production
rails db:migrate
rails assets:precompile
rails server
MAKE LOCAL LIKE REMOTE REPO:
git fetch --prune origin
git reset --hard origin/master
<HEAD is now at cff714b :sparkles: feat: Setup Devise-Email-Activation>
git clean -f -d
GIT REMOTES: one version of your repo that live on other servers
git remote -v
git remote add heroku https://git.heroku.com/j3-photo-app.git
git remote rm heroku
git remote add heroku https://git.heroku.com/j3-photo-blog-app.git
git remotes -v
git push heroku master
git push heroku master --force
SSH - GIT
ssh-keygen -t ed25519 -C "gi***@gmail.com"
val "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed2***
cat ~/.ssh/id_ed2***.pub
GOTO Settings/security and PASTE IT
git config --global user.name "jaythree"
git config --global user.email "gil***@gmail.com"
# git clone will give you the whole repository.
# After the clone, you can list the tags with git tag -l;
# then checkout a specific tag: git checkout tags/<tag_name>
git clone <repo-address>
git tag -l
git checkout <tag-name>
or
git clone -b rails_blog_v7 [email protected]:giljr/rails_blog_demo.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment