Undo Local changes in Git

git reset —hard

git reset --hard allows you to remove all changes to local files. This is final.

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   vue-cart/index.html

no changes added to commit (use "git add" and/or "git commit -a")
$ git reset --hard
HEAD is now at b25f597 Creating a simple Cart
$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

git reset HEAD

git reset HEAD <file> allows you reset changes to the last commit. This is final.

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   vue-cart/main.js

no changes added to commit (use "git add" and/or "git commit -a")
$ git reset HEAD vue-cart/main.js 
Unstaged changes after reset:
M	vue-cart/main.js

 PG::ConnectionBad (could not connect to server)

PG::ConnectionBad (could not connect to server: Connection refused
	Is the server running on host "localhost" (::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (127.0.0.1) and accepting
	TCP/IP connections on port 5432?
)

This is something that most likely resulted when a PostgreSQL server was updated but the databases weren’t updated to the current version.

Here is a simple fix that could help you.

brew postgresql-upgrade-database

 brew postgresql-upgrade-database
==> brew install postgresql@10
==> Downloading https://homebrew.bintray.com/bottles/postgresql@10-10.10_1.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/0b/0bfd1011bd9500221b4213c86699a13c692acdf41984e88a1b86f2397ea11f15?__gda__=exp=1568557647~hmac=02a02995ee6bde2ee4d6871f6974b36d
######################################################################## 100.0%
[......]
==> Upgraded postgresql data from 10 to 11!
==> Your postgresql 10 data remains at /usr/local/var/postgres.old
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)

Everything would hopefully be working for you too!

 Capybara Cheatsheet

Navigation

visit('/posts')
visit(post_path(post))

Clicking Links and Buttons

click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text')
click('Button Value')

Interacting with Forms

fill_in('First Name', :with => 'Mark')
fill_in('Password', :with => 'password')
fill_in('Description', :with => 'Description')
choose('radio button')
check('checkbox')
uncheck('checkbox')
attach_file('image field', '/path/to/image.png')

 Setting Ruby versions with rbenv

Use specific Ruby version with rbenv

rbenv shell _version_

$ rbenv shell 2.6.3
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
$ rbenv shell 2.5.1
$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin18]

Set specific Ruby version globally

rbenv global _version_

$ cat ~/.rbenv/version
2.3.1
$ rbenv global 2.5.1
$ cat ~/.rbenv/version
2.5.1

Deleting global .ruby-version with rbenv

rbenv global --unset

$ rbenv global 2.5.1
$ cat ~/.rbenv/version
2.5.1
$ rbenv global --unset
$ cat ~/.rbenv/version 
cat: .ruby-version: No such file or directory

Set specific Ruby version by setting .ruby-version

rbenv local _version_

$ rbenv local 2.3.1
$ cat .ruby-version 
2.3.1
$ rbenv local 2.5.1
$ cat .ruby-version 
2.5.1

Deleting local .ruby-version with rbenv

rbenv local --unset

$ rbenv local 2.5.1
$ cat .ruby-version 
2.5.1
$ rbenv local --unset
$ cat .ruby-version 
cat: .ruby-version: No such file or directory

Reference

rbenv github project