From 607672cd651205d023a58966d4da6e98b99b9626 Mon Sep 17 00:00:00 2001 From: Hugo <1h.lust.hugo@gmail.com> Date: Fri, 2 Apr 2021 15:42:17 +0200 Subject: [PATCH] Added stash, amend rebase and gitignore --- readme.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 443a726..9bac85c 100644 --- a/readme.md +++ b/readme.md @@ -210,4 +210,32 @@ temporarily stash your work since your last commit >git stash pop -fetch your stashed work to continue it \ No newline at end of file +fetch your stashed work to continue it + +$ git stash pop stash@{2} + +in case you want to apply a specific Stash item (not the most recent one), you can provide the index name of that item in the "pop" option + +### Rewriting history + +>git commit --amend -m "New commit message" + +replace the message of the last commit without altering the snapshot + +>git commit --amend --no-edit + +replace the latest commit with a commit that includes recents git add + +>git rebase -i {branch} + +take the precedent commit and add it to your branch + +### Ignoring files + +>touch .gitignore && echo {what you want to ignore} >> .gitignore + +create a file and specify what (extensions, directories, files) to ignore in it + +>git rm --cached {fileignored} + +remove from the tracking index a file that should be ignored but wasnt because already tracked when the ignore rule was created