Skip to content

pountzas/My-coding-Notes

Repository files navigation

My-coding-Notes

git/github

Magic link https://www.freecodecamp.org/news/git-cheat-sheet/

delete a branch localy

git branch -D friendshipsV2

Unstaging 1 file from added files to stage

git restore .\spec\models\frienship_spec.rb --staged

Undo changes since last commit:

git clean -fd
git reset --hard

Delete last commit from github

  • Load previus commit
  • Push by force to roleback and delete commits from github

git reset HEAD^ --hard
git push -f

Uncheck last commit

git reset --soft HEAD~1

Git stash

git stash temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on. Stashing is handy if you need to quickly switch context and work on something else, but you're mid-way through a code change and aren't quite ready to commit.

Stashing your work

git stash
At this point you're free to make changes, create new commits, switch branches, and perform any other Git operations; then come back and re-apply your stash when you're ready. Note that the stash is local to your Git repository; stashes are not transferred to the server when you push.

Re-applying your stashed changes

git stash pop
Popping your stash removes the changes from your stash and reapplies them to your working copy. Alternatively, you can reapply the changes to your working copy and keep them in your stash with git stash apply

Stashing untracked or ignored files

git stash -u
Adding the -u option (or --include-untracked) tells git stash to also stash your untracked files

Creating a branch from your stash

If the changes on your branch diverge from the changes in your stash, you may run into conflicts when popping or applying your stash. Instead, you can use git stash branch to create a new branch to apply your stashed changes.
git stash branch add-stylesheet stash@{1}

Other usefull commands

git stash list
git stash save "add style to our site"
git stash pop stash@{2}
git stash drop stash@{1}
git stash clear

Use subtree push to send it to the gh-pages branch on GitHub.

git add dist -f && git commit -m "Initial dist subtree commit"
git subtree push --prefix dist origin gh-pages

Boom. If your folder isn’t called dist, then you’ll need to change that in each of the commands above.

Git Bisect

git bisect start

Heroku

Instalation

install on wsl

curl https://cli-assets.heroku.com/install-ubuntu.sh | sh

push to heroku

heroku create
git push heroku main

or whatever branch

heroku rename name

change app name on heroku side

https://devcenter.heroku.com/articles/getting-started-with-rails5

to change the stack

heroku stack:set heroku-18 --app ror-social-friends

when deploy and “We're sorry, but something went wrong.”

heroku rake db:migrate --app ror-social-friends
heroku restart --app ror-social-friends

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published