A developer notebook I should have started 10 years ago..

Rails HTTP status codes

100 :continue
101 :switching_protocols
102 :processing

200 :ok
201 :created
202 :accepted
203 :non_authoritative_information
204 :no_content
205 :reset_content
206 :partial_content
207 :multi_status
208 :already_reported

300 :multiple_choices
301 :moved_permanently
302 :found
303 :see_other
304 :not_modified
305 :use_proxy
306 :reserved
307 :temporary_redirect
308 :permanent_redirect

400 :bad_request
401 :unauthorized
402 :payment_required
403 :forbidden
404 :not_found
405 :method_not_allowed
406 :not_acceptable
407 :proxy_authentication_required
408 :request_timeout
409 :conflict
410 :gone
411 :length_required
412 :precondition_failed
413 :request_entity_too_large
414 :request_uri_too_long
415 :unsupported_media_type
416 :requested_range_not_satisfiable
417 :expectation_failed
422 :unprocessable_entity
423 :locked
424 :failed_dependency
426 :upgrade_required

500 :internal_server_error
501 :not_implemented
502 :bad_gateway
503 :service_unavailable
504 :gateway_timeout
505 :http_version_not_supported
506 :variant_also_negotiates
507 :insufficient_storage
508 :loop_detected

Git stash options

TLDR

How can I stash all the files, even the untracked ones?

git stash -u

How can I avoid conflicts when I pop my stash entry?

# Restore the stash entry on top of the commit
# that was HEAD at the time the git stash command was run

git stash branch <branch_name> 

Stash -u option

If you are a Git user, git stash [push]/ git stash pop should be well known from you.

But, do you already experience the “Oh sh**, git stash didn’t stash my untracked files” ?

Next time, just add the -u option.

From a such git status,

> git status

On branch 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:   README.md

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	  CHANGELOG.md
no changes added to commit (use "git add" and/or "git commit -a")

if you run git stash

> git stash

Saved working directory and index state WIP on master: 9296abd Add README

> git status

On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	CHANGELOG.md

nothing added to commit but untracked files present (use "git add" to track)

if you run git stash -u

> git stash -u

Saved working directory and index state WIP on master: 9296abd Add README

> git status

On branch master
nothing to commit, working tree clean

Branch command

Another issue Developers are used to experiencing is getting conflicts after git stash pop because the branch on which they ran git stash has changed since the stash was done.

Instead of git stash pop run git stash branch [branch_name]. Git will restore the stash entry on a new branch you named on top of the HEAD commit at the time the git stash command was run.

Suppose you try to pop changes to the README.md file, updated since your stash.

> git stash pop

Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
The stash entry is kept in case you need it again.

With the branch command, your changes are applied to a new readme_update branch on top of the latest commit at the time you stashed.

> git stash branch readme_update

Switched to a new branch 'readme_update'
On branch readme_update
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:   README.md

no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (aaaaa4ef4365f9e7218f21233a9b477100e6d8f68)

Resources: