From a40ed5c6bd3baab2a12414c529beef41de70b3a7 Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 12:22:09 +0400 Subject: [PATCH 01/12] Site label code edited. Started swears and its partials. --- _data/site.js | 10 +++++++ az/noswears/index.html | 6 ++++ az/noswears/partials/footer.njk | 5 ++++ az/noswears/partials/intro.njk | 3 ++ az/noswears/partials/outro.njk | 1 + az/noswears/partials/thanks.njk | 4 +++ az/noswears/tips/01-magic-time-machine.md | 18 ++++++++++++ az/noswears/tips/02-change-last-commit.md | 18 ++++++++++++ .../tips/03-change-last-commit-message.md | 12 ++++++++ .../tips/04-accidental-commit-master.md | 17 +++++++++++ .../tips/05-accidental-commit-wrong-branch.md | 29 +++++++++++++++++++ az/noswears/tips/06-dude-wheres-my-diff.md | 14 +++++++++ az/noswears/tips/07-undo-a-commit.md | 21 ++++++++++++++ az/noswears/tips/08-undo-a-file.md | 18 ++++++++++++ az/noswears/tips/20-fuck-this-noise.md | 29 +++++++++++++++++++ az/noswears/tips/tips.json | 1 + az/swears/index.html | 6 ++++ az/swears/partials/banner.njk | 1 + az/swears/partials/footer.njk | 6 ++++ az/swears/partials/intro.njk | 3 ++ az/swears/partials/outro.njk | 1 + az/swears/partials/thanks.njk | 4 +++ az/swears/tips/01-magic-time-machine.md | 18 ++++++++++++ az/swears/tips/02-change-last-commit.md | 18 ++++++++++++ .../tips/03-change-last-commit-message.md | 12 ++++++++ az/swears/tips/04-accidental-commit-master.md | 17 +++++++++++ .../tips/05-accidental-commit-wrong-branch.md | 29 +++++++++++++++++++ az/swears/tips/06-dude-wheres-my-diff.md | 14 +++++++++ az/swears/tips/07-undo-a-commit.md | 21 ++++++++++++++ az/swears/tips/08-undo-a-file.md | 18 ++++++++++++ az/swears/tips/20-fuck-this-noise.md | 29 +++++++++++++++++++ az/swears/tips/tips.json | 1 + 32 files changed, 404 insertions(+) create mode 100644 az/noswears/index.html create mode 100644 az/noswears/partials/footer.njk create mode 100644 az/noswears/partials/intro.njk create mode 100644 az/noswears/partials/outro.njk create mode 100644 az/noswears/partials/thanks.njk create mode 100644 az/noswears/tips/01-magic-time-machine.md create mode 100644 az/noswears/tips/02-change-last-commit.md create mode 100644 az/noswears/tips/03-change-last-commit-message.md create mode 100644 az/noswears/tips/04-accidental-commit-master.md create mode 100644 az/noswears/tips/05-accidental-commit-wrong-branch.md create mode 100644 az/noswears/tips/06-dude-wheres-my-diff.md create mode 100644 az/noswears/tips/07-undo-a-commit.md create mode 100644 az/noswears/tips/08-undo-a-file.md create mode 100644 az/noswears/tips/20-fuck-this-noise.md create mode 100644 az/noswears/tips/tips.json create mode 100644 az/swears/index.html create mode 100644 az/swears/partials/banner.njk create mode 100644 az/swears/partials/footer.njk create mode 100644 az/swears/partials/intro.njk create mode 100644 az/swears/partials/outro.njk create mode 100644 az/swears/partials/thanks.njk create mode 100644 az/swears/tips/01-magic-time-machine.md create mode 100644 az/swears/tips/02-change-last-commit.md create mode 100644 az/swears/tips/03-change-last-commit-message.md create mode 100644 az/swears/tips/04-accidental-commit-master.md create mode 100644 az/swears/tips/05-accidental-commit-wrong-branch.md create mode 100644 az/swears/tips/06-dude-wheres-my-diff.md create mode 100644 az/swears/tips/07-undo-a-commit.md create mode 100644 az/swears/tips/08-undo-a-file.md create mode 100644 az/swears/tips/20-fuck-this-noise.md create mode 100644 az/swears/tips/tips.json diff --git a/_data/site.js b/_data/site.js index b6766624..297fa779 100644 --- a/_data/site.js +++ b/_data/site.js @@ -8,6 +8,11 @@ module.exports = { code: "af", arialabel: "Sien die webblad in ander tale", }, + { + label: "Azərbaycanca", + code: "az", + arialabel: "Başqa dillərdə oxuyun", + }, { label: "বাংলা", code: "bn", @@ -160,6 +165,11 @@ module.exports = { link: "https://github.com/michaeljabotha", lang: "af", }, + { + name: "Zaman Kazimov", + link: "https://github.com/kazimovzaman2", + lang: "az", + }, { name: "Moritz Stückler", link: "https://github.com/pReya", diff --git a/az/noswears/index.html b/az/noswears/index.html new file mode 100644 index 00000000..3d8640a1 --- /dev/null +++ b/az/noswears/index.html @@ -0,0 +1,6 @@ +--- +layout: layouts/page.njk +locale: az +contentType: noswears +title: Dangit, Git!?! +--- \ No newline at end of file diff --git a/az/noswears/partials/footer.njk b/az/noswears/partials/footer.njk new file mode 100644 index 00000000..535e57aa --- /dev/null +++ b/az/noswears/partials/footer.njk @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/az/noswears/partials/intro.njk b/az/noswears/partials/intro.njk new file mode 100644 index 00000000..3b73ec30 --- /dev/null +++ b/az/noswears/partials/intro.njk @@ -0,0 +1,3 @@ +

Git is hard: messing up is easy, and figuring out how to fix your mistakes is impossible. Git documentation has this chicken and egg problem where you can't search for how to get yourself out of a mess, unless you already know the name of the thing you need to know about in order to fix your problem.

+ +

So here are some bad situations I've gotten myself into, and how I eventually got myself out of them in plain english.

diff --git a/az/noswears/partials/outro.njk b/az/noswears/partials/outro.njk new file mode 100644 index 00000000..73f0d938 --- /dev/null +++ b/az/noswears/partials/outro.njk @@ -0,0 +1 @@ +

*Disclaimer: This site is not intended to be an exhaustive reference. And yes, there are other ways to do these same things with more theoretical purity or whatever, but I've come to these steps through trial and error and lots of swearing and table flipping, and I had this crazy idea to share them with a healthy dose of levity. Take it or leave it as you will!

\ No newline at end of file diff --git a/az/noswears/partials/thanks.njk b/az/noswears/partials/thanks.njk new file mode 100644 index 00000000..e4e21c88 --- /dev/null +++ b/az/noswears/partials/thanks.njk @@ -0,0 +1,4 @@ +

Many thanks to everyone who has volunteered to translate the site into new languages, you rock! +{% include "partials/collaborator-list.njk" %}. With additional help from {% include "partials/otherhelper-list.njk" %}

+ +

If you'd like to help add a translation into your language, submit a PR on {% github_link %}

\ No newline at end of file diff --git a/az/noswears/tips/01-magic-time-machine.md b/az/noswears/tips/01-magic-time-machine.md new file mode 100644 index 00000000..f36441de --- /dev/null +++ b/az/noswears/tips/01-magic-time-machine.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: Dangit, I did something terribly wrong, please tell me git has a magic time machine!?! +id: magic-time-machine +order: 1 +--- + +```git +git reflog +# you will see a list of every thing you've +# done in git, across all branches! +# each one has an index HEAD@{index} +# find the one before you broke everything +git reset HEAD@{index} +# magic time machine +``` + +You can use this to get back stuff you accidentally deleted, or just to remove some stuff you tried that broke the repo, or to recover after a bad merge, or just to go back to a time when things actually worked. I use `reflog` A LOT. Mega hat tip to the many many many many many people who suggested adding it! \ No newline at end of file diff --git a/az/noswears/tips/02-change-last-commit.md b/az/noswears/tips/02-change-last-commit.md new file mode 100644 index 00000000..e0bfb7d9 --- /dev/null +++ b/az/noswears/tips/02-change-last-commit.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: Dangit, I committed and immediately realized I need to make one small change! +id: change-last-commit +order: 2 +--- + +```git +# make your change +git add . # or add individual files +git commit --amend --no-edit +# now your last commit contains that change! +# WARNING: never amend public commits +``` + +This usually happens to me if I commit, then run tests/linters... and ugh, I didn't put a space after an equals sign. You could also make the change as a new commit and then do `rebase -i` in order to squash them both together, but this is about a million times faster. + +*Warning: You should never amend commits that have been pushed up to a public/shared branch! Only amend commits that only exist in your local copy or you're gonna have a bad time.* \ No newline at end of file diff --git a/az/noswears/tips/03-change-last-commit-message.md b/az/noswears/tips/03-change-last-commit-message.md new file mode 100644 index 00000000..a299599b --- /dev/null +++ b/az/noswears/tips/03-change-last-commit-message.md @@ -0,0 +1,12 @@ +--- +tags: tip +title: Dangit, I need to change the message on my last commit! +id: change-last-commit-message +order: 3 +--- +```git +git commit --amend +# follow prompts to change the commit message +``` + +Stupid commit message formatting requirements. \ No newline at end of file diff --git a/az/noswears/tips/04-accidental-commit-master.md b/az/noswears/tips/04-accidental-commit-master.md new file mode 100644 index 00000000..1b753962 --- /dev/null +++ b/az/noswears/tips/04-accidental-commit-master.md @@ -0,0 +1,17 @@ +--- +tags: tip +title: Dangit, I accidentally committed something to master that should have been on a brand new branch! +id: accidental-commit-master +order: 4 +--- + +```git +# create a new branch from the current state of master +git branch some-new-branch-name +# remove the last commit from the master branch +git reset HEAD~ --hard +git checkout some-new-branch-name +# your commit lives in this branch now :) +``` + +Note: this doesn't work if you've already pushed the commit to a public/shared branch, and if you tried other things first, you might need to `git reset HEAD@{number-of-commits-back}` instead of `HEAD~`. Infinite sadness. Also, many many many people suggested an awesome way to make this shorter that I didn't know myself. Thank you all! \ No newline at end of file diff --git a/az/noswears/tips/05-accidental-commit-wrong-branch.md b/az/noswears/tips/05-accidental-commit-wrong-branch.md new file mode 100644 index 00000000..79754ce7 --- /dev/null +++ b/az/noswears/tips/05-accidental-commit-wrong-branch.md @@ -0,0 +1,29 @@ +--- +tags: tip +title: Dangit, I accidentally committed to the wrong branch! +id: accidental-commit-wrong-branch +order: 5 +--- + +```git +# undo the last commit, but leave the changes available +git reset HEAD~ --soft +git stash +# move to the correct branch +git checkout name-of-the-correct-branch +git stash pop +git add . # or add individual files +git commit -m "your message here" +# now your changes are on the correct branch +``` + +A lot of people have suggested using `cherry-pick` for this situation too, so take your pick on whatever one makes the most sense to you! + +```git +git checkout name-of-the-correct-branch +# grab the last commit to master +git cherry-pick master +# delete it from master +git checkout master +git reset HEAD~ --hard +``` \ No newline at end of file diff --git a/az/noswears/tips/06-dude-wheres-my-diff.md b/az/noswears/tips/06-dude-wheres-my-diff.md new file mode 100644 index 00000000..99fc1bbe --- /dev/null +++ b/az/noswears/tips/06-dude-wheres-my-diff.md @@ -0,0 +1,14 @@ +--- +tags: tip +title: Dangit, I tried to run a diff but nothing happened?! +id: dude-wheres-my-diff +order: 6 +--- + +If you know that you made changes to files, but `diff` is empty, you probably `add`-ed your files to staging and you need to use a special flag. + +```git +git diff --staged +``` + +File under ¯\\\_(ツ)\_/¯ (yes, I know this is a feature, not a bug, but it's baffling and non-obvious the first time it happens to you!) diff --git a/az/noswears/tips/07-undo-a-commit.md b/az/noswears/tips/07-undo-a-commit.md new file mode 100644 index 00000000..7b42c291 --- /dev/null +++ b/az/noswears/tips/07-undo-a-commit.md @@ -0,0 +1,21 @@ +--- +tags: tip +title: Dangit, I need to undo a commit from like 5 commits ago! +id: undo-a-commit +order: 7 +--- + +```git +# find the commit you need to undo +git log +# use the arrow keys to scroll up and down in history +# once you've found your commit, save the hash +git revert [saved hash] +# git will create a new commit that undoes that commit +# follow prompts to edit the commit message +# or just save and commit +``` + +Turns out you don't have to track down and copy-paste the old file contents into the existing file in order to undo changes! If you committed a bug, you can undo the commit all in one go with `revert`. + +You can also revert a single file instead of a full commit! But of course, in true git fashion, it's a completely different set of commands... diff --git a/az/noswears/tips/08-undo-a-file.md b/az/noswears/tips/08-undo-a-file.md new file mode 100644 index 00000000..4216aa2e --- /dev/null +++ b/az/noswears/tips/08-undo-a-file.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: Dangit, I need to undo my changes to a file! +id: undo-a-file +order: 8 +--- + +```git +# find a hash for a commit before the file was changed +git log +# use the arrow keys to scroll up and down in history +# once you've found your commit, save the hash +git checkout [saved hash] -- path/to/file +# the old version of the file will be in your index +git commit -m "Wow, you don't have to copy-paste to undo" +``` + +When I finally figured this out it was HUGE. HUGE. H-U-G-E. But seriously though, on what planet does `checkout --` make sense as the best way to undo a file? :shakes-fist-at-linus-torvalds: \ No newline at end of file diff --git a/az/noswears/tips/20-fuck-this-noise.md b/az/noswears/tips/20-fuck-this-noise.md new file mode 100644 index 00000000..b45a0d07 --- /dev/null +++ b/az/noswears/tips/20-fuck-this-noise.md @@ -0,0 +1,29 @@ +--- +tags: tip +title: Forget this noise, I give up. +id: forget-this-noise +note: this should always be the last one in the list, so setting order to 20 so I don't have to re-name/re-order it +order: 20 +--- + +```git +cd .. +sudo rm -r stupid-git-repo-dir +git clone https://some.github.url/stupid-git-repo-dir.git +cd stupid-git-repo-dir +``` + +Thanks to Eric V. for this one. All complaints about the use of `sudo` in this joke can be directed to him. + + +For real though, if your branch is sooo borked that you need to reset the state of your repo to be the same as the remote repo in a "git-approved" way, try this, but beware these are destructive and unrecoverable actions! + +```git +# get the lastest state of origin +git fetch origin +git checkout master +git reset --hard origin/master +# delete untracked files and directories +git clean -d --force +# repeat checkout/reset/clean for each borked branch +``` \ No newline at end of file diff --git a/az/noswears/tips/tips.json b/az/noswears/tips/tips.json new file mode 100644 index 00000000..d0b2aa62 --- /dev/null +++ b/az/noswears/tips/tips.json @@ -0,0 +1 @@ +{ "permalink": false } diff --git a/az/swears/index.html b/az/swears/index.html new file mode 100644 index 00000000..9ff82168 --- /dev/null +++ b/az/swears/index.html @@ -0,0 +1,6 @@ +--- +layout: layouts/page.njk +locale: az +contentType: swears +title: Ay sikim, Git!?! +--- \ No newline at end of file diff --git a/az/swears/partials/banner.njk b/az/swears/partials/banner.njk new file mode 100644 index 00000000..02a4af02 --- /dev/null +++ b/az/swears/partials/banner.njk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/az/swears/partials/footer.njk b/az/swears/partials/footer.njk new file mode 100644 index 00000000..5821af50 --- /dev/null +++ b/az/swears/partials/footer.njk @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/az/swears/partials/intro.njk b/az/swears/partials/intro.njk new file mode 100644 index 00000000..341bfd9a --- /dev/null +++ b/az/swears/partials/intro.njk @@ -0,0 +1,3 @@ +

Git çətindir: sıçıb bulamaq isə asan, və səhvlərinizi necə düzəldəcəyinizi tampaq da mümkünsüz kimi bir şeydi. Git dokumentasiyasına girib axtarmağa başladığınızda, bu zir zibilin içindən necə canınızı qurtaracağınızı tapmağın tək yolunun qarşılaşdığınız xətanın adının nə olduğunu bilirsizsə mümkün ola biləcəyini başa düşürsüz. Sonra toyuq yumurtadan çıxıb yumurtamı toyuqdan fikirlərinə gedirsiz.

+ +

Və buna görə də, burada özümün içindən çıxa bilmədiyim vəziyyətləri, və bunlardan bir müddət sonra necə canımı qurtardığımı sadə dildə Azərbaycanca izah etməyə çalışacam.

diff --git a/az/swears/partials/outro.njk b/az/swears/partials/outro.njk new file mode 100644 index 00000000..fc7edfd2 --- /dev/null +++ b/az/swears/partials/outro.njk @@ -0,0 +1 @@ +

*Etiraz: Bu saytın təfərruatlı bir mənbə olmaq kimi bir məqsədi yoxdur. Və haqlısız, burda yazılan həlləri reallaşdırmanın daha teorik üsulları da var, amma mən bu həllərə sınama və səhv çıxma, çoxlu söyüşlər və ora bura masa tullamaqla gəldim və bunları həyasızlıq və söyüş ilə bölüşmək üçün dəli fikrim var idi. Ya istifadə edin, ya da buraxın getsin!

\ No newline at end of file diff --git a/az/swears/partials/thanks.njk b/az/swears/partials/thanks.njk new file mode 100644 index 00000000..e9ef016d --- /dev/null +++ b/az/swears/partials/thanks.njk @@ -0,0 +1,4 @@ +

Bu saytı yeni dillərə çevirmək üçün könüllü olan hər kəsə çox çox təşəkkürlər, möhtəşəmsiz! +{% include "partials/collaborator-list.njk" %}. Əlavə olaraq {% include "partials/otherhelper-list.njk" %}'ın köməyi ilə.

+ +

Əgər siz də kömək olub öz dilinizə çevirmək istəyirsizsə {% github_link %} repo'suna PR göndərin.

\ No newline at end of file diff --git a/az/swears/tips/01-magic-time-machine.md b/az/swears/tips/01-magic-time-machine.md new file mode 100644 index 00000000..cfee8219 --- /dev/null +++ b/az/swears/tips/01-magic-time-machine.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: Oh shit, I did something terribly wrong, please tell me git has a magic time machine!?! +id: magic-time-machine +order: 1 +--- + +```git +git reflog +# you will see a list of every thing you've +# done in git, across all branches! +# each one has an index HEAD@{index} +# find the one before you broke everything +git reset HEAD@{index} +# magic time machine +``` + +You can use this to get back stuff you accidentally deleted, or just to remove some stuff you tried that broke the repo, or to recover after a bad merge, or just to go back to a time when things actually worked. I use `reflog` A LOT. Mega hat tip to the many many many many many people who suggested adding it! \ No newline at end of file diff --git a/az/swears/tips/02-change-last-commit.md b/az/swears/tips/02-change-last-commit.md new file mode 100644 index 00000000..b217f17b --- /dev/null +++ b/az/swears/tips/02-change-last-commit.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: Oh shit, I committed and immediately realized I need to make one small change! +id: change-last-commit +order: 2 +--- + +```git +# make your change +git add . # or add individual files +git commit --amend --no-edit +# now your last commit contains that change! +# WARNING: never amend public commits +``` + +This usually happens to me if I commit, then run tests/linters... and FML, I didn't put a space after an equals sign. You could also make the change as a new commit and then do `rebase -i` in order to squash them both together, but this is about a million times faster. + +*Warning: You should never amend commits that have been pushed up to a public/shared branch! Only amend commits that only exist in your local copy or you're gonna have a bad time.* \ No newline at end of file diff --git a/az/swears/tips/03-change-last-commit-message.md b/az/swears/tips/03-change-last-commit-message.md new file mode 100644 index 00000000..876d3bd7 --- /dev/null +++ b/az/swears/tips/03-change-last-commit-message.md @@ -0,0 +1,12 @@ +--- +tags: tip +title: Oh shit, I need to change the message on my last commit! +id: change-last-commit-message +order: 3 +--- +```git +git commit --amend +# follow prompts to change the commit message +``` + +Stupid commit message formatting requirements. \ No newline at end of file diff --git a/az/swears/tips/04-accidental-commit-master.md b/az/swears/tips/04-accidental-commit-master.md new file mode 100644 index 00000000..c34f0c62 --- /dev/null +++ b/az/swears/tips/04-accidental-commit-master.md @@ -0,0 +1,17 @@ +--- +tags: tip +title: Oh shit, I accidentally committed something to master that should have been on a brand new branch! +id: accidental-commit-master +order: 4 +--- + +```git +# create a new branch from the current state of master +git branch some-new-branch-name +# remove the last commit from the master branch +git reset HEAD~ --hard +git checkout some-new-branch-name +# your commit lives in this branch now :) +``` + +Note: this doesn't work if you've already pushed the commit to a public/shared branch, and if you tried other things first, you might need to `git reset HEAD@{number-of-commits-back}` instead of `HEAD~`. Infinite sadness. Also, many many many people suggested an awesome way to make this shorter that I didn't know myself. Thank you all! \ No newline at end of file diff --git a/az/swears/tips/05-accidental-commit-wrong-branch.md b/az/swears/tips/05-accidental-commit-wrong-branch.md new file mode 100644 index 00000000..f24048cb --- /dev/null +++ b/az/swears/tips/05-accidental-commit-wrong-branch.md @@ -0,0 +1,29 @@ +--- +tags: tip +title: Oh shit, I accidentally committed to the wrong branch! +id: accidental-commit-wrong-branch +order: 5 +--- + +```git +# undo the last commit, but leave the changes available +git reset HEAD~ --soft +git stash +# move to the correct branch +git checkout name-of-the-correct-branch +git stash pop +git add . # or add individual files +git commit -m "your message here"; +# now your changes are on the correct branch +``` + +A lot of people have suggested using `cherry-pick` for this situation too, so take your pick on whatever one makes the most sense to you! + +```git +git checkout name-of-the-correct-branch +# grab the last commit to master +git cherry-pick master +# delete it from master +git checkout master +git reset HEAD~ --hard +``` \ No newline at end of file diff --git a/az/swears/tips/06-dude-wheres-my-diff.md b/az/swears/tips/06-dude-wheres-my-diff.md new file mode 100644 index 00000000..4eaf6e25 --- /dev/null +++ b/az/swears/tips/06-dude-wheres-my-diff.md @@ -0,0 +1,14 @@ +--- +tags: tip +title: Oh shit, I tried to run a diff but nothing happened?! +id: dude-wheres-my-diff +order: 6 +--- + +If you know that you made changes to files, but `diff` is empty, you probably `add`-ed your files to staging and you need to use a special flag. + +```git +git diff --staged +``` + +File under ¯\\\_(ツ)\_/¯ (yes, I know this is a feature, not a bug, but it's fucking baffling and non-obvious the first time it happens to you!) diff --git a/az/swears/tips/07-undo-a-commit.md b/az/swears/tips/07-undo-a-commit.md new file mode 100644 index 00000000..411c2eb5 --- /dev/null +++ b/az/swears/tips/07-undo-a-commit.md @@ -0,0 +1,21 @@ +--- +tags: tip +title: Oh shit, I need to undo a commit from like 5 commits ago! +id: undo-a-commit +order: 7 +--- + +```git +# find the commit you need to undo +git log +# use the arrow keys to scroll up and down in history +# once you've found your commit, save the hash +git revert [saved hash] +# git will create a new commit that undoes that commit +# follow prompts to edit the commit message +# or just save and commit +``` + +Turns out you don't have to track down and copy-paste the old file contents into the existing file in order to undo changes! If you committed a bug, you can undo the commit all in one go with `revert`. + +You can also revert a single file instead of a full commit! But of course, in true git fashion, it's a completely different set of fucking commands... \ No newline at end of file diff --git a/az/swears/tips/08-undo-a-file.md b/az/swears/tips/08-undo-a-file.md new file mode 100644 index 00000000..e0fcc63f --- /dev/null +++ b/az/swears/tips/08-undo-a-file.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: Oh shit, I need to undo my changes to a file! +id: undo-a-file +order: 8 +--- + +```git +# find a hash for a commit before the file was changed +git log +# use the arrow keys to scroll up and down in history +# once you've found your commit, save the hash +git checkout [saved hash] -- path/to/file +# the old version of the file will be in your index +git commit -m "Wow, you don't have to copy-paste to undo" +``` + +When I finally figured this out it was HUGE. HUGE. H-U-G-E. But seriously though, on what fucking planet does `checkout --` make sense as the best way to undo a file? :shakes-fist-at-linus-torvalds: \ No newline at end of file diff --git a/az/swears/tips/20-fuck-this-noise.md b/az/swears/tips/20-fuck-this-noise.md new file mode 100644 index 00000000..5c4cf582 --- /dev/null +++ b/az/swears/tips/20-fuck-this-noise.md @@ -0,0 +1,29 @@ +--- +tags: tip +title: Fuck this noise, I give up. +id: fuck-this-noise +note: this should always be the last one in the list, so setting order to 20 so I don't have to re-name/re-order it +order: 20 +--- + +```git +cd .. +sudo rm -r fucking-git-repo-dir +git clone https://some.github.url/fucking-git-repo-dir.git +cd fucking-git-repo-dir +``` + +Thanks to Eric V. for this one. All complaints about the use of `sudo` in this joke can be directed to him. + + +For real though, if your branch is sooo borked that you need to reset the state of your repo to be the same as the remote repo in a "git-approved" way, try this, but beware these are destructive and unrecoverable actions! + +```git +# get the lastest state of origin +git fetch origin +git checkout master +git reset --hard origin/master +# delete untracked files and directories +git clean -d --force +# repeat checkout/reset/clean for each borked branch +``` \ No newline at end of file diff --git a/az/swears/tips/tips.json b/az/swears/tips/tips.json new file mode 100644 index 00000000..d0b2aa62 --- /dev/null +++ b/az/swears/tips/tips.json @@ -0,0 +1 @@ +{ "permalink": false } From e833e9892eae6447523ace8517993f15d0ca0c14 Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 12:39:44 +0400 Subject: [PATCH 02/12] Translated /swears/tips/01 --- az/swears/tips/01-magic-time-machine.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/az/swears/tips/01-magic-time-machine.md b/az/swears/tips/01-magic-time-machine.md index cfee8219..b4af9d8f 100644 --- a/az/swears/tips/01-magic-time-machine.md +++ b/az/swears/tips/01-magic-time-machine.md @@ -1,18 +1,18 @@ --- tags: tip -title: Oh shit, I did something terribly wrong, please tell me git has a magic time machine!?! +title: Ay sikim, çox böyük bir səhv etdim, nolar git'in bunu geri alacaq sehirli zaman maşını olduğunu de!?! id: magic-time-machine order: 1 --- ```git git reflog -# you will see a list of every thing you've -# done in git, across all branches! -# each one has an index HEAD@{index} -# find the one before you broke everything +# bütün branch'lar daxil, git'də etdiyiniz +# hər bir şeyin siyahısını görəcəksiniz! +# Hər birinin HEAD@{index} formatında indeksi var +# sıçıb bulamazdan əvvəlki təmiz vəziyyəti tap, git reset HEAD@{index} -# magic time machine +# bu da sənə zaman maşını. ``` -You can use this to get back stuff you accidentally deleted, or just to remove some stuff you tried that broke the repo, or to recover after a bad merge, or just to go back to a time when things actually worked. I use `reflog` A LOT. Mega hat tip to the many many many many many people who suggested adding it! \ No newline at end of file +Siz bunu səhvən sildiyiniz bir şeyi geri qaytarmaq və ya sadəcə reponu pozan bəzi şeyləri silmək və ya pox kimi merge'ü geri qaytarmaq ya da hər şeyin işlədiyi vaxta geri qayıtmaq üçün istifadə edə bilərsiz. Mən `reflog`'u çox istifadə edirəm. Bunu buraya əlavə etməyi tövsiyyə edən hər kəsə təşəkkür edirəm. \ No newline at end of file From e0d5f43561214cd9750d592de69397b09259c5d6 Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 14:20:58 +0400 Subject: [PATCH 03/12] 2, 3, 4 --- az/swears/tips/02-change-last-commit.md | 14 +++++++------- az/swears/tips/03-change-last-commit-message.md | 6 +++--- az/swears/tips/04-accidental-commit-master.md | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/az/swears/tips/02-change-last-commit.md b/az/swears/tips/02-change-last-commit.md index b217f17b..80f5e03d 100644 --- a/az/swears/tips/02-change-last-commit.md +++ b/az/swears/tips/02-change-last-commit.md @@ -1,18 +1,18 @@ --- tags: tip -title: Oh shit, I committed and immediately realized I need to make one small change! +title: Ay sikim, Kodları commit'lədim və yadıma düşdü ki, kiçik bir dəyişiklik də etməliyəm! id: change-last-commit order: 2 --- ```git -# make your change -git add . # or add individual files +# dəyişikliyinizi edin +git add . # və ya faylları vir bir adını yazın git commit --amend --no-edit -# now your last commit contains that change! -# WARNING: never amend public commits +# və son commit bu dəyişiklikləri də içinə alacaq! +# XƏBƏRDARLIQ: heç vaxt push etdiyiniz commit'ləri amend etməyin! ``` -This usually happens to me if I commit, then run tests/linters... and FML, I didn't put a space after an equals sign. You could also make the change as a new commit and then do `rebase -i` in order to squash them both together, but this is about a million times faster. +Bu çox vaxtı mənim başıma kodu commit edəndən sonra test'ləri/linter'i vs. işlədəndən sonra gəlir, məsələn, beynimi sikim, bərabərdir işarəsindən sonra boşluq qoymaq yadımdan çıxır. Bunu etməyin başqa bir yolu da, lazım olan dəyişiklikləri yeni bir commit içində yaradıb, `rebase -i` komandası ilə ikisini birləşdirməkdir, amma bu üsul hardasa 1 milyon dəfə daha sürətlidir. -*Warning: You should never amend commits that have been pushed up to a public/shared branch! Only amend commits that only exist in your local copy or you're gonna have a bad time.* \ No newline at end of file +*Xəbərdarlıq: Mütləq public/shared branch'lara push ettiyiniz bir commit'i amend etməməlisiniz! Sadəcə local'da olan commit'i amend eləməlisiz, əks təqdirdə altı dəyə bilər.* \ No newline at end of file diff --git a/az/swears/tips/03-change-last-commit-message.md b/az/swears/tips/03-change-last-commit-message.md index 876d3bd7..8fac8a78 100644 --- a/az/swears/tips/03-change-last-commit-message.md +++ b/az/swears/tips/03-change-last-commit-message.md @@ -1,12 +1,12 @@ --- tags: tip -title: Oh shit, I need to change the message on my last commit! +title: Ay sikim, axırıncı commit'dəki mesajı dəyişməliyəm! id: change-last-commit-message order: 3 --- ```git git commit --amend -# follow prompts to change the commit message +# commit mesajını dəyişdirmək üçün göstərişlərə əməl edin ``` -Stupid commit message formatting requirements. \ No newline at end of file +Soxduğumux commit mesaj format tələbləri. \ No newline at end of file diff --git a/az/swears/tips/04-accidental-commit-master.md b/az/swears/tips/04-accidental-commit-master.md index c34f0c62..d6ba8093 100644 --- a/az/swears/tips/04-accidental-commit-master.md +++ b/az/swears/tips/04-accidental-commit-master.md @@ -1,17 +1,17 @@ --- tags: tip -title: Oh shit, I accidentally committed something to master that should have been on a brand new branch! +title: Ay sikim, Səhvən yeni branch açıb oraya commitləməli olduğum şeyi, master branch'na commitlədim! id: accidental-commit-master order: 4 --- ```git -# create a new branch from the current state of master +# master'in indiki halıylı yeni branch açın git branch some-new-branch-name -# remove the last commit from the master branch +# master'dən son commit'i silin git reset HEAD~ --hard git checkout some-new-branch-name -# your commit lives in this branch now :) +# yeni commit artıq bu branch'da yaşıyacaq :) ``` -Note: this doesn't work if you've already pushed the commit to a public/shared branch, and if you tried other things first, you might need to `git reset HEAD@{number-of-commits-back}` instead of `HEAD~`. Infinite sadness. Also, many many many people suggested an awesome way to make this shorter that I didn't know myself. Thank you all! \ No newline at end of file +Qeyd: əgər commit'i çoxdan public/shared repo'ya push etmisinizsə, və əvvəlcə başla şeyləri yoxlamısınızsa, bu işə yaramıyacaq, onun yerinə də `HEAD~` əvəzinə `git reset HEAD@{1-2-commit-əvvəl}` yoxluyun. Sonsuz qəm-kədər. Mənim bildiyimdən çox çox daha qısa yolla mənə məsləhət görən bir çox adam oldu. Hamısına çox təşəkkürlər! \ No newline at end of file From ed3da60966fe987f8c239f14db75e6875d8e49cd Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 14:25:52 +0400 Subject: [PATCH 04/12] 5 --- az/swears/tips/02-change-last-commit.md | 2 +- .../tips/05-accidental-commit-wrong-branch.md | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/az/swears/tips/02-change-last-commit.md b/az/swears/tips/02-change-last-commit.md index 80f5e03d..ed035c64 100644 --- a/az/swears/tips/02-change-last-commit.md +++ b/az/swears/tips/02-change-last-commit.md @@ -7,7 +7,7 @@ order: 2 ```git # dəyişikliyinizi edin -git add . # və ya faylları vir bir adını yazın +git add . # və ya faylları bir bir adını yazın git commit --amend --no-edit # və son commit bu dəyişiklikləri də içinə alacaq! # XƏBƏRDARLIQ: heç vaxt push etdiyiniz commit'ləri amend etməyin! diff --git a/az/swears/tips/05-accidental-commit-wrong-branch.md b/az/swears/tips/05-accidental-commit-wrong-branch.md index f24048cb..7f67ec34 100644 --- a/az/swears/tips/05-accidental-commit-wrong-branch.md +++ b/az/swears/tips/05-accidental-commit-wrong-branch.md @@ -1,29 +1,29 @@ --- tags: tip -title: Oh shit, I accidentally committed to the wrong branch! +title: Ay sikim, səhvən kodu başqa branch'a commitlədim! id: accidental-commit-wrong-branch order: 5 --- ```git -# undo the last commit, but leave the changes available +# son commit'i geri al, amma dəyişikliklər qalsın git reset HEAD~ --soft git stash -# move to the correct branch -git checkout name-of-the-correct-branch +# düzgün branch'a keç +git checkout düzgün-branch-adı git stash pop -git add . # or add individual files -git commit -m "your message here"; -# now your changes are on the correct branch +git add . # və ya faylları bir bir adını yazın +git commit -m "mesajın"; +# indi dəyişikliklərin düzgün branch'a keçdi ``` -A lot of people have suggested using `cherry-pick` for this situation too, so take your pick on whatever one makes the most sense to you! +Çox adam bu vəziyyət üçün `cherry-pick` komandasını da istifadəsini tövsiyyə edir, ona görə hansı sizə daha rahat gəlirsə onu istifadə edə bilərsiz. ```git -git checkout name-of-the-correct-branch -# grab the last commit to master +git checkout düzgün-branch-adı +# master'dəki son commit'i al git cherry-pick master -# delete it from master +# master'dən o commit'i sil git checkout master git reset HEAD~ --hard ``` \ No newline at end of file From c80bae829f5ed8593fc1b912924ea678278fac5f Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 14:31:26 +0400 Subject: [PATCH 05/12] 06 --- az/swears/tips/06-dude-wheres-my-diff.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/az/swears/tips/06-dude-wheres-my-diff.md b/az/swears/tips/06-dude-wheres-my-diff.md index 4eaf6e25..d8085633 100644 --- a/az/swears/tips/06-dude-wheres-my-diff.md +++ b/az/swears/tips/06-dude-wheres-my-diff.md @@ -1,14 +1,14 @@ --- tags: tip -title: Oh shit, I tried to run a diff but nothing happened?! +title: Ay sikim, iki saatdı diff eləməyə çalışıram, amma nəticə yoxdu?! id: dude-wheres-my-diff order: 6 --- -If you know that you made changes to files, but `diff` is empty, you probably `add`-ed your files to staging and you need to use a special flag. +Faylları dəyiştirdiyinizi bilirsiniz, amma `diff` komandası sizə nəticə vermirsə, böyük ehtimal faylları `add`'ləmişsiniz və sizə lazım olan xüsusi flag istifadə etməlisiniz. ```git git diff --staged ``` -File under ¯\\\_(ツ)\_/¯ (yes, I know this is a feature, not a bug, but it's fucking baffling and non-obvious the first time it happens to you!) +¯\\\_(ツ)\_/¯ kateqoriyasını əlavə edin. (bəli, bu bir xüsusiyyətdir, səhv deyil, amma beyin sikir və ilk dəfə qarşılaşan adam nə edəcəyini bilmir.) \ No newline at end of file From c929111a2ec4c3ba7fd6b46d88ff596f3094c36d Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 14:40:20 +0400 Subject: [PATCH 06/12] 07 --- az/swears/tips/07-undo-a-commit.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/az/swears/tips/07-undo-a-commit.md b/az/swears/tips/07-undo-a-commit.md index 411c2eb5..5529f869 100644 --- a/az/swears/tips/07-undo-a-commit.md +++ b/az/swears/tips/07-undo-a-commit.md @@ -1,21 +1,21 @@ --- tags: tip -title: Oh shit, I need to undo a commit from like 5 commits ago! +title: Ay sikim, 5-6 commit əvvəl qeyd olunan commit'i geri almalıyam! id: undo-a-commit order: 7 --- ```git -# find the commit you need to undo +# geri alınacaq commit'i tapın git log -# use the arrow keys to scroll up and down in history -# once you've found your commit, save the hash -git revert [saved hash] -# git will create a new commit that undoes that commit -# follow prompts to edit the commit message -# or just save and commit +# ox düymələrini istifadə edərək keçmişdə yuxarı/aşağı gəzinin +# commit'i tapanda, hash'ini kopyalayın +git revert [kopyalanan hash] +# git sizin üçün bunu geri alan bir commit yaradacaq +# commit mesajını göstərişləri edin +# və ya sadıcı saxlayın və commit'ləyin ``` -Turns out you don't have to track down and copy-paste the old file contents into the existing file in order to undo changes! If you committed a bug, you can undo the commit all in one go with `revert`. +Bir dəyişikliyi geri almaq üçün dəyişən yerləri tapıb bir bir yeni fayllara kopyalamaq lazım deyilmiş! Əgər səhvən bug'ı commit etmisinizsə, `revert` ilə commit'i geri ala bilərsiniz. -You can also revert a single file instead of a full commit! But of course, in true git fashion, it's a completely different set of fucking commands... \ No newline at end of file +Hətta, tüm bir commit'i geri almaq əvəzinə, tək bir fayl da geri ala bilərsiz! A düzdü, həqiqi git metoduna görə, hər sikiş komandanın fərqlı komandası var... \ No newline at end of file From 6a8514cd545cf28db11fa17b375e987806830fca Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 14:47:03 +0400 Subject: [PATCH 07/12] 08 --- az/swears/tips/08-undo-a-file.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/az/swears/tips/08-undo-a-file.md b/az/swears/tips/08-undo-a-file.md index e0fcc63f..3b630225 100644 --- a/az/swears/tips/08-undo-a-file.md +++ b/az/swears/tips/08-undo-a-file.md @@ -1,18 +1,18 @@ --- tags: tip -title: Oh shit, I need to undo my changes to a file! +title: Ay sikim, bir fayldaki dəyişiklikləri ger almalıyam! id: undo-a-file order: 8 --- ```git -# find a hash for a commit before the file was changed +# fayl dəyişməzdən əvvəlki halının hashini tap git log -# use the arrow keys to scroll up and down in history -# once you've found your commit, save the hash -git checkout [saved hash] -- path/to/file -# the old version of the file will be in your index -git commit -m "Wow, you don't have to copy-paste to undo" +# ox düymələrini istifadə edərək keçmişdə yuxarı/aşağı gəzinin +# commit'i tapanda, hash'ini kopyalayın +git checkout [kopyalanan hash] -- faylın/papqası/adı +# faylın köhnə halı indi index'dədir +git commit -m "Vay vay, geri almaq üçün copy paste'ə ehtiyac yoxuymuş" ``` -When I finally figured this out it was HUGE. HUGE. H-U-G-E. But seriously though, on what fucking planet does `checkout --` make sense as the best way to undo a file? :shakes-fist-at-linus-torvalds: \ No newline at end of file +Bunu öyrənəndə mənim üçün MÖHTƏŞƏM'iydi. MÖHTƏŞƏM. MÖH-TƏ-ŞƏM. Amma həqiqətən, hansı soxduğumun planetində `checkout --` istifadə edərək bir faylın geri alınmasının ən yaxşı yolunun bu olduğu məntiqlidi ki? :shakes-fist-at-linus-torvalds: \ No newline at end of file From eee4f77a498778e9dac5a6dc09a422a63295338d Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 14:56:03 +0400 Subject: [PATCH 08/12] 20 --- az/swears/tips/20-fuck-this-noise.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/az/swears/tips/20-fuck-this-noise.md b/az/swears/tips/20-fuck-this-noise.md index 5c4cf582..21826f20 100644 --- a/az/swears/tips/20-fuck-this-noise.md +++ b/az/swears/tips/20-fuck-this-noise.md @@ -1,6 +1,6 @@ --- tags: tip -title: Fuck this noise, I give up. +title: İçini sikim bezdim, başını buraxıram. id: fuck-this-noise note: this should always be the last one in the list, so setting order to 20 so I don't have to re-name/re-order it order: 20 @@ -8,22 +8,22 @@ order: 20 ```git cd .. -sudo rm -r fucking-git-repo-dir -git clone https://some.github.url/fucking-git-repo-dir.git -cd fucking-git-repo-dir +sudo rm -r osduraq-git +git clone https://some.github.url/osduraq-git.git +cd osduraq-git ``` -Thanks to Eric V. for this one. All complaints about the use of `sudo` in this joke can be directed to him. +Bu misala görə Eric V.-ə təşəkkür edirəm. Bu zarafatda `sudo` istifadəsinə dair bütün şikayətlər ona ünvanlana bilər. +Amma həqiqətən, əgər local branch'ın götü dağılıbsa, və bu vəziyyəti remote repo'daki son halına "git-approved" bir şəkildə geri qaytarmaq istiyirsinizsə, bunu eliyin, amma diqqətli olun, bu proses dağıdıcı və geri dönülməyən bir yoldur. -For real though, if your branch is sooo borked that you need to reset the state of your repo to be the same as the remote repo in a "git-approved" way, try this, but beware these are destructive and unrecoverable actions! ```git -# get the lastest state of origin +# origin'in son vəziyyəti git fetch origin git checkout master git reset --hard origin/master -# delete untracked files and directories +# izlənilməyən faylları və qovluqları silin git clean -d --force -# repeat checkout/reset/clean for each borked branch +# bütün sikik branch'lar üçün bunu təkrar edin ``` \ No newline at end of file From c3fda3cb095ba46a4641fecbd09ede015a5d946c Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 15:14:25 +0400 Subject: [PATCH 09/12] Fix some issues --- az/swears/partials/banner.njk | 2 +- az/swears/partials/intro.njk | 2 +- az/swears/partials/outro.njk | 2 +- az/swears/tips/02-change-last-commit.md | 4 ++-- az/swears/tips/03-change-last-commit-message.md | 2 +- az/swears/tips/04-accidental-commit-master.md | 6 +++--- az/swears/tips/05-accidental-commit-wrong-branch.md | 2 +- az/swears/tips/06-dude-wheres-my-diff.md | 2 +- az/swears/tips/07-undo-a-commit.md | 6 +++--- az/swears/tips/08-undo-a-file.md | 10 +++++----- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/az/swears/partials/banner.njk b/az/swears/partials/banner.njk index 02a4af02..3d0015da 100644 --- a/az/swears/partials/banner.njk +++ b/az/swears/partials/banner.njk @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/az/swears/partials/intro.njk b/az/swears/partials/intro.njk index 341bfd9a..8fcbb42d 100644 --- a/az/swears/partials/intro.njk +++ b/az/swears/partials/intro.njk @@ -1,3 +1,3 @@ -

Git çətindir: sıçıb bulamaq isə asan, və səhvlərinizi necə düzəldəcəyinizi tampaq da mümkünsüz kimi bir şeydi. Git dokumentasiyasına girib axtarmağa başladığınızda, bu zir zibilin içindən necə canınızı qurtaracağınızı tapmağın tək yolunun qarşılaşdığınız xətanın adının nə olduğunu bilirsizsə mümkün ola biləcəyini başa düşürsüz. Sonra toyuq yumurtadan çıxıb yumurtamı toyuqdan fikirlərinə gedirsiz.

+

Git çətindir: sıçıb bulamaq isə asan, və səhvlərinizi necə düzəldəcəyinizi tampaq da mümkünsüz kimi bir şeydi. Git dokumentasiyasına girib axtarmağa başladığınızda, bu zir zibilin içindən necə canınızı qurtaracağınızı tapmaq istəyirsiz və bunun tək yolu qarşılaşdığınız xətanın adının nə olduğunu bilirsizsə mümkün ola biləcəyini başa düşürsüz. Sonra toyuq yumurtadan çıxıb yumurtamı toyuqdan deyə fikirləşirsiz.

Və buna görə də, burada özümün içindən çıxa bilmədiyim vəziyyətləri, və bunlardan bir müddət sonra necə canımı qurtardığımı sadə dildə Azərbaycanca izah etməyə çalışacam.

diff --git a/az/swears/partials/outro.njk b/az/swears/partials/outro.njk index fc7edfd2..61f8c687 100644 --- a/az/swears/partials/outro.njk +++ b/az/swears/partials/outro.njk @@ -1 +1 @@ -

*Etiraz: Bu saytın təfərruatlı bir mənbə olmaq kimi bir məqsədi yoxdur. Və haqlısız, burda yazılan həlləri reallaşdırmanın daha teorik üsulları da var, amma mən bu həllərə sınama və səhv çıxma, çoxlu söyüşlər və ora bura masa tullamaqla gəldim və bunları həyasızlıq və söyüş ilə bölüşmək üçün dəli fikrim var idi. Ya istifadə edin, ya da buraxın getsin!

\ No newline at end of file +

*Etiraz: Bu saytın təfərruatlı bir mənbə olmaq kimi bir məqsədi yoxdur. Və haqlısız, burda yazılan həlləri reallaşdırmanın daha teorik üsulları da var, amma mən bu həllərə sınama və səhv çıxma, çoxlu söyüşlər və ora bura masa tullamaqla gəldim və bunları həyasızlıq və söyüş ilə bölüşmək üçün dəli fikrim var idi. Ya istifadə edin, ya da başını buraxın getsin!

\ No newline at end of file diff --git a/az/swears/tips/02-change-last-commit.md b/az/swears/tips/02-change-last-commit.md index ed035c64..b34e6701 100644 --- a/az/swears/tips/02-change-last-commit.md +++ b/az/swears/tips/02-change-last-commit.md @@ -7,7 +7,7 @@ order: 2 ```git # dəyişikliyinizi edin -git add . # və ya faylları bir bir adını yazın +git add . # və ya faylların bir bir adını yazın git commit --amend --no-edit # və son commit bu dəyişiklikləri də içinə alacaq! # XƏBƏRDARLIQ: heç vaxt push etdiyiniz commit'ləri amend etməyin! @@ -15,4 +15,4 @@ git commit --amend --no-edit Bu çox vaxtı mənim başıma kodu commit edəndən sonra test'ləri/linter'i vs. işlədəndən sonra gəlir, məsələn, beynimi sikim, bərabərdir işarəsindən sonra boşluq qoymaq yadımdan çıxır. Bunu etməyin başqa bir yolu da, lazım olan dəyişiklikləri yeni bir commit içində yaradıb, `rebase -i` komandası ilə ikisini birləşdirməkdir, amma bu üsul hardasa 1 milyon dəfə daha sürətlidir. -*Xəbərdarlıq: Mütləq public/shared branch'lara push ettiyiniz bir commit'i amend etməməlisiniz! Sadəcə local'da olan commit'i amend eləməlisiz, əks təqdirdə altı dəyə bilər.* \ No newline at end of file +*Xəbərdarlıq: public/shared branch'lara push ettiyiniz bir commit'i amend etməməlisiniz! Sadəcə local'da olan commit'i amend eləməlisiz, əks təqdirdə altı dəyə bilər.* \ No newline at end of file diff --git a/az/swears/tips/03-change-last-commit-message.md b/az/swears/tips/03-change-last-commit-message.md index 8fac8a78..5416421e 100644 --- a/az/swears/tips/03-change-last-commit-message.md +++ b/az/swears/tips/03-change-last-commit-message.md @@ -9,4 +9,4 @@ git commit --amend # commit mesajını dəyişdirmək üçün göstərişlərə əməl edin ``` -Soxduğumux commit mesaj format tələbləri. \ No newline at end of file +Soxduğumun commit mesajının format tələbləri. \ No newline at end of file diff --git a/az/swears/tips/04-accidental-commit-master.md b/az/swears/tips/04-accidental-commit-master.md index d6ba8093..bf43a5cb 100644 --- a/az/swears/tips/04-accidental-commit-master.md +++ b/az/swears/tips/04-accidental-commit-master.md @@ -1,12 +1,12 @@ --- tags: tip -title: Ay sikim, Səhvən yeni branch açıb oraya commitləməli olduğum şeyi, master branch'na commitlədim! +title: Ay sikim, Səhvən yeni branch açıb oraya commit'ləməli olduğum şeyi, master branch'a commitlədim! id: accidental-commit-master order: 4 --- ```git -# master'in indiki halıylı yeni branch açın +# master'in indiki halıyla yeni branch açın git branch some-new-branch-name # master'dən son commit'i silin git reset HEAD~ --hard @@ -14,4 +14,4 @@ git checkout some-new-branch-name # yeni commit artıq bu branch'da yaşıyacaq :) ``` -Qeyd: əgər commit'i çoxdan public/shared repo'ya push etmisinizsə, və əvvəlcə başla şeyləri yoxlamısınızsa, bu işə yaramıyacaq, onun yerinə də `HEAD~` əvəzinə `git reset HEAD@{1-2-commit-əvvəl}` yoxluyun. Sonsuz qəm-kədər. Mənim bildiyimdən çox çox daha qısa yolla mənə məsləhət görən bir çox adam oldu. Hamısına çox təşəkkürlər! \ No newline at end of file +Qeyd: əgər commit'i çoxdan public/shared repo'ya push etmisinizsə, və əvvəlcə başla şeyləri yoxlamısınızsa, bu işə yaramıyacaq, onun yerinə də `HEAD~` əvəzinə `git reset HEAD@{1-2-commit-əvvəl}` yoxluyun. Sonsuz qəm-kədər. Mənim bildiyimdən çox çox daha qısa yolları mənə məsləhət görən bir çox adam oldu. Hamısına çox təşəkkürlər! \ No newline at end of file diff --git a/az/swears/tips/05-accidental-commit-wrong-branch.md b/az/swears/tips/05-accidental-commit-wrong-branch.md index 7f67ec34..b2fe8221 100644 --- a/az/swears/tips/05-accidental-commit-wrong-branch.md +++ b/az/swears/tips/05-accidental-commit-wrong-branch.md @@ -12,7 +12,7 @@ git stash # düzgün branch'a keç git checkout düzgün-branch-adı git stash pop -git add . # və ya faylları bir bir adını yazın +git add . # və ya faylların bir bir adını yazın git commit -m "mesajın"; # indi dəyişikliklərin düzgün branch'a keçdi ``` diff --git a/az/swears/tips/06-dude-wheres-my-diff.md b/az/swears/tips/06-dude-wheres-my-diff.md index d8085633..aa997d97 100644 --- a/az/swears/tips/06-dude-wheres-my-diff.md +++ b/az/swears/tips/06-dude-wheres-my-diff.md @@ -5,7 +5,7 @@ id: dude-wheres-my-diff order: 6 --- -Faylları dəyiştirdiyinizi bilirsiniz, amma `diff` komandası sizə nəticə vermirsə, böyük ehtimal faylları `add`'ləmişsiniz və sizə lazım olan xüsusi flag istifadə etməlisiniz. +Fayllarda dəyişlik etdiyinizi bilirsiniz, amma `diff` komandası sizə nəticə vermirsə, böyük ehtimal faylları `add`'ləmişsiniz və sizə lazım olan xüsusi flag istifadə etməlisiniz. ```git git diff --staged diff --git a/az/swears/tips/07-undo-a-commit.md b/az/swears/tips/07-undo-a-commit.md index 5529f869..08578c0f 100644 --- a/az/swears/tips/07-undo-a-commit.md +++ b/az/swears/tips/07-undo-a-commit.md @@ -9,13 +9,13 @@ order: 7 # geri alınacaq commit'i tapın git log # ox düymələrini istifadə edərək keçmişdə yuxarı/aşağı gəzinin -# commit'i tapanda, hash'ini kopyalayın +# commit'i tapanda, hash'ni kopyalayın git revert [kopyalanan hash] # git sizin üçün bunu geri alan bir commit yaradacaq # commit mesajını göstərişləri edin -# və ya sadıcı saxlayın və commit'ləyin +# və ya sadəcə saxlayın və commit'ləyin ``` Bir dəyişikliyi geri almaq üçün dəyişən yerləri tapıb bir bir yeni fayllara kopyalamaq lazım deyilmiş! Əgər səhvən bug'ı commit etmisinizsə, `revert` ilə commit'i geri ala bilərsiniz. -Hətta, tüm bir commit'i geri almaq əvəzinə, tək bir fayl da geri ala bilərsiz! A düzdü, həqiqi git metoduna görə, hər sikiş komandanın fərqlı komandası var... \ No newline at end of file +Hətta, tüm bir commit'i geri almaq əvəzinə, tək bir fayl da geri ala bilərsiz! A düzdü, həqiqi git metoduna görə, hər sikiş funksiyanın fərqlı komandası var... \ No newline at end of file diff --git a/az/swears/tips/08-undo-a-file.md b/az/swears/tips/08-undo-a-file.md index 3b630225..d3361ec5 100644 --- a/az/swears/tips/08-undo-a-file.md +++ b/az/swears/tips/08-undo-a-file.md @@ -1,18 +1,18 @@ --- tags: tip -title: Ay sikim, bir fayldaki dəyişiklikləri ger almalıyam! +title: Ay sikim, bir fayldaki dəyişiklikləri geri almalıyam! id: undo-a-file order: 8 --- ```git -# fayl dəyişməzdən əvvəlki halının hashini tap +# fayl dəyişməzdən əvvəlki halının hash'ni tap git log # ox düymələrini istifadə edərək keçmişdə yuxarı/aşağı gəzinin -# commit'i tapanda, hash'ini kopyalayın -git checkout [kopyalanan hash] -- faylın/papqası/adı +# commit'i tapanda, hash'ni kopyalayın +git checkout [kopyalanan hash] -- qovluq/və/faylın/adı # faylın köhnə halı indi index'dədir git commit -m "Vay vay, geri almaq üçün copy paste'ə ehtiyac yoxuymuş" ``` -Bunu öyrənəndə mənim üçün MÖHTƏŞƏM'iydi. MÖHTƏŞƏM. MÖH-TƏ-ŞƏM. Amma həqiqətən, hansı soxduğumun planetində `checkout --` istifadə edərək bir faylın geri alınmasının ən yaxşı yolunun bu olduğu məntiqlidi ki? :shakes-fist-at-linus-torvalds: \ No newline at end of file +Bunu öyrənmək mənim üçün MÖHTƏŞƏM'iydi. MÖHTƏŞƏM. MÖH-TƏ-ŞƏM. Amma həqiqətən, hansı soxduğumun planetində `checkout --` istifadə edərək bir faylın geri alınmasının ən yaxşı yolunun bu olduğu məntiqlidi ki? :shakes-fist-at-linus-torvalds: \ No newline at end of file From 227181800a14c8d00a35bfc4b38b3266ff9ee2be Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 15:23:21 +0400 Subject: [PATCH 10/12] partials --- az/noswears/index.html | 2 +- az/noswears/partials/footer.njk | 2 +- az/noswears/partials/intro.njk | 4 ++-- az/noswears/partials/outro.njk | 2 +- az/noswears/partials/thanks.njk | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/az/noswears/index.html b/az/noswears/index.html index 3d8640a1..880af590 100644 --- a/az/noswears/index.html +++ b/az/noswears/index.html @@ -2,5 +2,5 @@ layout: layouts/page.njk locale: az contentType: noswears -title: Dangit, Git!?! +title: İçinə zibil, Git!?! --- \ No newline at end of file diff --git a/az/noswears/partials/footer.njk b/az/noswears/partials/footer.njk index 535e57aa..2ad58c51 100644 --- a/az/noswears/partials/footer.njk +++ b/az/noswears/partials/footer.njk @@ -1,5 +1,5 @@
- What's your Dang it, git moment? Share it with me! + Sənin içinə zibil, git hekayən nədir? Mənimlə paylaş! {{site.copyright | safe}}
\ No newline at end of file diff --git a/az/noswears/partials/intro.njk b/az/noswears/partials/intro.njk index 3b73ec30..0916fbea 100644 --- a/az/noswears/partials/intro.njk +++ b/az/noswears/partials/intro.njk @@ -1,3 +1,3 @@ -

Git is hard: messing up is easy, and figuring out how to fix your mistakes is impossible. Git documentation has this chicken and egg problem where you can't search for how to get yourself out of a mess, unless you already know the name of the thing you need to know about in order to fix your problem.

+

Git çətindir: hər şeyi dağıtmaq isə asan, və səhvlərinizi necə düzəldəcəyinizi tampaq da mümkünsüz kimi bir şeydi. Git dokumentasiyasına girib axtarmağa başladığınızda, bu qarmaşıqlıq içindən necə canınızı qurtaracağınızı tapmaq istəyirsiz və bunun tək yolu qarşılaşdığınız xətanın adının nə olduğunu bilirsizsə mümkün ola biləcəyini başa düşürsüz. Sonra toyuq yumurtadan çıxıb yumurtamı toyuqdan deyə fikirləşirsiz.

-

So here are some bad situations I've gotten myself into, and how I eventually got myself out of them in plain english.

+

Və buna görə də, burada özümün içindən çıxa bilmədiyim vəziyyətləri, və bunlardan bir müddət sonra necə canımı qurtardığımı sadə dildə Azərbaycanca izah etməyə çalışacam.

diff --git a/az/noswears/partials/outro.njk b/az/noswears/partials/outro.njk index 73f0d938..61f8c687 100644 --- a/az/noswears/partials/outro.njk +++ b/az/noswears/partials/outro.njk @@ -1 +1 @@ -

*Disclaimer: This site is not intended to be an exhaustive reference. And yes, there are other ways to do these same things with more theoretical purity or whatever, but I've come to these steps through trial and error and lots of swearing and table flipping, and I had this crazy idea to share them with a healthy dose of levity. Take it or leave it as you will!

\ No newline at end of file +

*Etiraz: Bu saytın təfərruatlı bir mənbə olmaq kimi bir məqsədi yoxdur. Və haqlısız, burda yazılan həlləri reallaşdırmanın daha teorik üsulları da var, amma mən bu həllərə sınama və səhv çıxma, çoxlu söyüşlər və ora bura masa tullamaqla gəldim və bunları həyasızlıq və söyüş ilə bölüşmək üçün dəli fikrim var idi. Ya istifadə edin, ya da başını buraxın getsin!

\ No newline at end of file diff --git a/az/noswears/partials/thanks.njk b/az/noswears/partials/thanks.njk index e4e21c88..e9ef016d 100644 --- a/az/noswears/partials/thanks.njk +++ b/az/noswears/partials/thanks.njk @@ -1,4 +1,4 @@ -

Many thanks to everyone who has volunteered to translate the site into new languages, you rock! -{% include "partials/collaborator-list.njk" %}. With additional help from {% include "partials/otherhelper-list.njk" %}

+

Bu saytı yeni dillərə çevirmək üçün könüllü olan hər kəsə çox çox təşəkkürlər, möhtəşəmsiz! +{% include "partials/collaborator-list.njk" %}. Əlavə olaraq {% include "partials/otherhelper-list.njk" %}'ın köməyi ilə.

-

If you'd like to help add a translation into your language, submit a PR on {% github_link %}

\ No newline at end of file +

Əgər siz də kömək olub öz dilinizə çevirmək istəyirsizsə {% github_link %} repo'suna PR göndərin.

\ No newline at end of file From 1ab7d953219d4a30d090b2cbaad9f2b50ff5222f Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 15:53:38 +0400 Subject: [PATCH 11/12] Noswears --- az/noswears/tips/01-magic-time-machine.md | 16 ++++++++------ az/noswears/tips/02-change-last-commit.md | 14 ++++++------ .../tips/03-change-last-commit-message.md | 6 ++--- .../tips/04-accidental-commit-master.md | 10 ++++----- .../tips/05-accidental-commit-wrong-branch.md | 22 +++++++++---------- az/noswears/tips/06-dude-wheres-my-diff.md | 6 ++--- az/noswears/tips/07-undo-a-commit.md | 20 ++++++++--------- az/noswears/tips/08-undo-a-file.md | 16 +++++++------- az/noswears/tips/20-fuck-this-noise.md | 18 +++++++-------- az/swears/tips/01-magic-time-machine.md | 2 +- .../tips/03-change-last-commit-message.md | 2 +- az/swears/tips/04-accidental-commit-master.md | 2 +- az/swears/tips/07-undo-a-commit.md | 2 +- 13 files changed, 69 insertions(+), 67 deletions(-) diff --git a/az/noswears/tips/01-magic-time-machine.md b/az/noswears/tips/01-magic-time-machine.md index f36441de..154f54c1 100644 --- a/az/noswears/tips/01-magic-time-machine.md +++ b/az/noswears/tips/01-magic-time-machine.md @@ -1,18 +1,20 @@ --- tags: tip -title: Dangit, I did something terribly wrong, please tell me git has a magic time machine!?! +title: İçinə zibil, çox böyük bir səhv etdim, nolar git'in bunu geri alacaq sehirli zaman maşını olduğunu de!?! id: magic-time-machine order: 1 --- ```git git reflog -# you will see a list of every thing you've -# done in git, across all branches! -# each one has an index HEAD@{index} -# find the one before you broke everything +# bütün branch'lar daxil, git'də etdiyiniz +# hər bir şeyin siyahısını görəcəksiniz! +# Hər birinin HEAD@{index} formatında indeksi var +# səhvlərdən əvvəlki təmiz vəziyyəti tap, git reset HEAD@{index} -# magic time machine +# bu da sənə zaman maşını ``` -You can use this to get back stuff you accidentally deleted, or just to remove some stuff you tried that broke the repo, or to recover after a bad merge, or just to go back to a time when things actually worked. I use `reflog` A LOT. Mega hat tip to the many many many many many people who suggested adding it! \ No newline at end of file +You can use this to get back stuff you accidentally deleted, or just to remove some stuff you tried that broke the repo, or to recover after a bad merge, or just to go back to a time when things actually worked. I use `reflog` A LOT. Mega hat tip to the many many many many many people who suggested adding it! + +Siz bunu səhvən sildiyiniz bir şeyi geri qaytarmaq və ya sadəcə reponu pozan bəzi şeyləri silmək və ya bərbad merge'ü geri qaytarmaq ya da hər şeyin işlədiyi vaxta geri qayıtmaq üçün istifadə edə bilərsiz. Mən `reflog`'u çox istifadə edirəm. Bunu buraya əlavə etməyi tövsiyyə edən hər kəsə təşəkkür edirəm. \ No newline at end of file diff --git a/az/noswears/tips/02-change-last-commit.md b/az/noswears/tips/02-change-last-commit.md index e0bfb7d9..fb9f0f1a 100644 --- a/az/noswears/tips/02-change-last-commit.md +++ b/az/noswears/tips/02-change-last-commit.md @@ -1,18 +1,18 @@ --- tags: tip -title: Dangit, I committed and immediately realized I need to make one small change! +title: İçinə zibli, Kodları commit'lədim və yadıma düşdü ki, kiçik bir dəyişiklik də etməliyəm! id: change-last-commit order: 2 --- ```git -# make your change -git add . # or add individual files +# dəyişikliyinizi edin +git add . # və ya faylların bir bir adını yazın git commit --amend --no-edit -# now your last commit contains that change! -# WARNING: never amend public commits +# və son commit bu dəyişiklikləri də içinə alacaq! +# XƏBƏRDARLIQ: heç vaxt push etdiyiniz commit'ləri amend etməyin! ``` -This usually happens to me if I commit, then run tests/linters... and ugh, I didn't put a space after an equals sign. You could also make the change as a new commit and then do `rebase -i` in order to squash them both together, but this is about a million times faster. +Bu çox vaxtı mənim başıma kodu commit edəndən sonra test'ləri/linter'i vs. işlədəndən sonra gəlir, məsələn, bərabərdir işarəsindən sonra boşluq qoymaq yadımdan çıxır. Bunu etməyin başqa bir yolu da, lazım olan dəyişiklikləri yeni bir commit içində yaradıb, `rebase -i` komandası ilə ikisini birləşdirməkdir, amma bu üsul hardasa 1 milyon dəfə daha sürətlidir. -*Warning: You should never amend commits that have been pushed up to a public/shared branch! Only amend commits that only exist in your local copy or you're gonna have a bad time.* \ No newline at end of file +*Xəbərdarlıq: public/shared branch'lara push ettiyiniz bir commit'i amend etməməlisiniz! Sadəcə local'da olan commit'i amend eləməlisiz, əks təqdirdə pis zaman keçirə bilərsiniz.* \ No newline at end of file diff --git a/az/noswears/tips/03-change-last-commit-message.md b/az/noswears/tips/03-change-last-commit-message.md index a299599b..28618327 100644 --- a/az/noswears/tips/03-change-last-commit-message.md +++ b/az/noswears/tips/03-change-last-commit-message.md @@ -1,12 +1,12 @@ --- tags: tip -title: Dangit, I need to change the message on my last commit! +title: İçinə zibil, axırıncı commit'dəki mesajı dəyişməliyəm! id: change-last-commit-message order: 3 --- ```git git commit --amend -# follow prompts to change the commit message +# commit mesajını dəyişdirmək üçün göstərişlərə əməl edin ``` -Stupid commit message formatting requirements. \ No newline at end of file +Mənasız commit mesajının format tələbləri... \ No newline at end of file diff --git a/az/noswears/tips/04-accidental-commit-master.md b/az/noswears/tips/04-accidental-commit-master.md index 1b753962..e1d151ee 100644 --- a/az/noswears/tips/04-accidental-commit-master.md +++ b/az/noswears/tips/04-accidental-commit-master.md @@ -1,17 +1,17 @@ --- tags: tip -title: Dangit, I accidentally committed something to master that should have been on a brand new branch! +title: İçinə zibil, Səhvən yeni branch açıb oraya commit'ləməli olduğum şeyi, master branch'a commitlədim! id: accidental-commit-master order: 4 --- ```git -# create a new branch from the current state of master +# master'in indiki halıyla yeni branch açın git branch some-new-branch-name -# remove the last commit from the master branch +# master'dən son commit'i silin git reset HEAD~ --hard git checkout some-new-branch-name -# your commit lives in this branch now :) +# yeni commit artıq bu branch'da yaşıyacaq :) ``` -Note: this doesn't work if you've already pushed the commit to a public/shared branch, and if you tried other things first, you might need to `git reset HEAD@{number-of-commits-back}` instead of `HEAD~`. Infinite sadness. Also, many many many people suggested an awesome way to make this shorter that I didn't know myself. Thank you all! \ No newline at end of file +Qeyd: əgər commit'i çoxdan public/shared repo'ya push etmisinizsə, və əvvəlcə başqa şeyləri yoxlamısınızsa, bu işə yaramıyacaq, onun yerinə də `HEAD~` əvəzinə `git reset HEAD@{1-2-commit-əvvəl}` yoxlayın. Sonsuz qəm-kədər. Mənim bildiyimdən çox çox daha qısa yolları mənə məsləhət görən bir çox adam oldu. Hamısına çox təşəkkürlər! \ No newline at end of file diff --git a/az/noswears/tips/05-accidental-commit-wrong-branch.md b/az/noswears/tips/05-accidental-commit-wrong-branch.md index 79754ce7..ff32c861 100644 --- a/az/noswears/tips/05-accidental-commit-wrong-branch.md +++ b/az/noswears/tips/05-accidental-commit-wrong-branch.md @@ -1,29 +1,29 @@ --- tags: tip -title: Dangit, I accidentally committed to the wrong branch! +title: İçinə zibil, səhvən kodu başqa branch'a commitlədim! id: accidental-commit-wrong-branch order: 5 --- ```git -# undo the last commit, but leave the changes available +# son commit'i geri al, amma dəyişikliklər qalsın git reset HEAD~ --soft git stash -# move to the correct branch -git checkout name-of-the-correct-branch +# düzgün branch'a keç +git checkout düzgün-branch-adı git stash pop -git add . # or add individual files -git commit -m "your message here" -# now your changes are on the correct branch +git add . # və ya faylların bir bir adını yazın +git commit -m "mesajın"; +# indi dəyişikliklərin düzgün branch'a keçdi ``` -A lot of people have suggested using `cherry-pick` for this situation too, so take your pick on whatever one makes the most sense to you! +Çox adam bu vəziyyət üçün `cherry-pick` komandasını da istifadəsini tövsiyyə edir, ona görə hansı sizə daha rahat gəlirsə onu istifadə edə bilərsiz. ```git -git checkout name-of-the-correct-branch -# grab the last commit to master +git checkout düzgün-branch-adı +# master'dəki son commit'i al git cherry-pick master -# delete it from master +# master'dən o commit'i sil git checkout master git reset HEAD~ --hard ``` \ No newline at end of file diff --git a/az/noswears/tips/06-dude-wheres-my-diff.md b/az/noswears/tips/06-dude-wheres-my-diff.md index 99fc1bbe..a7d5ec1a 100644 --- a/az/noswears/tips/06-dude-wheres-my-diff.md +++ b/az/noswears/tips/06-dude-wheres-my-diff.md @@ -1,14 +1,14 @@ --- tags: tip -title: Dangit, I tried to run a diff but nothing happened?! +title: İçinə zibil, iki saatdı diff eləməyə çalışıram, amma nəticə yoxdu?! id: dude-wheres-my-diff order: 6 --- -If you know that you made changes to files, but `diff` is empty, you probably `add`-ed your files to staging and you need to use a special flag. +Fayllarda dəyişlik etdiyinizi bilirsiniz, amma `diff` komandası sizə nəticə vermirsə, böyük ehtimal faylları `add`'ləmişsiniz və sizə lazım olan xüsusi flag istifadə etməlisiniz. ```git git diff --staged ``` -File under ¯\\\_(ツ)\_/¯ (yes, I know this is a feature, not a bug, but it's baffling and non-obvious the first time it happens to you!) +¯\\\_(ツ)\_/¯ kateqoriyasını əlavə edin. (bəli, bu bir xüsusiyyətdir, səhv deyil, amma baş ağrıdır və ilk dəfə qarşılaşan adam nə edəcəyini bilmir.) \ No newline at end of file diff --git a/az/noswears/tips/07-undo-a-commit.md b/az/noswears/tips/07-undo-a-commit.md index 7b42c291..eba8e469 100644 --- a/az/noswears/tips/07-undo-a-commit.md +++ b/az/noswears/tips/07-undo-a-commit.md @@ -1,21 +1,21 @@ --- tags: tip -title: Dangit, I need to undo a commit from like 5 commits ago! +title: İçinə zibil, 5-6 commit əvvəl qeyd olunan commit'i geri almalıyam! id: undo-a-commit order: 7 --- ```git -# find the commit you need to undo +# geri alınacaq commit'i tapın git log -# use the arrow keys to scroll up and down in history -# once you've found your commit, save the hash -git revert [saved hash] -# git will create a new commit that undoes that commit -# follow prompts to edit the commit message -# or just save and commit +# ox düymələrini istifadə edərək keçmişdə yuxarı/aşağı gəzinin +# commit'i tapanda, hash'ni kopyalayın +git revert [kopyalanan hash] +# git sizin üçün bunu geri alan bir commit yaradacaq +# commit mesajını göstərişləri edin +# və ya sadəcə saxlayın və commit'ləyin ``` -Turns out you don't have to track down and copy-paste the old file contents into the existing file in order to undo changes! If you committed a bug, you can undo the commit all in one go with `revert`. +Bir dəyişikliyi geri almaq üçün dəyişən yerləri tapıb bir bir yeni fayllara kopyalamaq lazım deyilmiş! Əgər səhvən bug'ı commit etmisinizsə, `revert` ilə commit'i geri ala bilərsiniz. -You can also revert a single file instead of a full commit! But of course, in true git fashion, it's a completely different set of commands... +Hətta, tüm bir commit'i geri almaq əvəzinə, tək bir fayl da geri ala bilərsiz! A düzdü, həqiqi git metoduna görə, hər funksiyanın fərqli komandası var... \ No newline at end of file diff --git a/az/noswears/tips/08-undo-a-file.md b/az/noswears/tips/08-undo-a-file.md index 4216aa2e..8ba264ab 100644 --- a/az/noswears/tips/08-undo-a-file.md +++ b/az/noswears/tips/08-undo-a-file.md @@ -1,18 +1,18 @@ --- tags: tip -title: Dangit, I need to undo my changes to a file! +title: İçinə zibil, bir fayldaki dəyişiklikləri geri almalıyam! id: undo-a-file order: 8 --- ```git -# find a hash for a commit before the file was changed +# fayl dəyişməzdən əvvəlki halının hash'ni tap git log -# use the arrow keys to scroll up and down in history -# once you've found your commit, save the hash -git checkout [saved hash] -- path/to/file -# the old version of the file will be in your index -git commit -m "Wow, you don't have to copy-paste to undo" +# ox düymələrini istifadə edərək keçmişdə yuxarı/aşağı gəzinin +# commit'i tapanda, hash'ni kopyalayın +git checkout [kopyalanan hash] -- qovluq/və/faylın/adı +# faylın köhnə halı indi index'dədir +git commit -m "Vay vay, geri almaq üçün copy paste'ə ehtiyac yoxuymuş" ``` -When I finally figured this out it was HUGE. HUGE. H-U-G-E. But seriously though, on what planet does `checkout --` make sense as the best way to undo a file? :shakes-fist-at-linus-torvalds: \ No newline at end of file +Bunu öyrənmək mənim üçün MÖHTƏŞƏM'iydi. MÖHTƏŞƏM. MÖH-TƏ-ŞƏM. Amma həqiqətən, hansı planetdə `checkout --` istifadə edərək bir faylın geri alınmasının ən yaxşı yolunun bu olduğu məntiqlidi ki? :shakes-fist-at-linus-torvalds: \ No newline at end of file diff --git a/az/noswears/tips/20-fuck-this-noise.md b/az/noswears/tips/20-fuck-this-noise.md index b45a0d07..8721000d 100644 --- a/az/noswears/tips/20-fuck-this-noise.md +++ b/az/noswears/tips/20-fuck-this-noise.md @@ -1,6 +1,6 @@ --- tags: tip -title: Forget this noise, I give up. +title: Bezdim, başını buraxıram. id: forget-this-noise note: this should always be the last one in the list, so setting order to 20 so I don't have to re-name/re-order it order: 20 @@ -8,22 +8,22 @@ order: 20 ```git cd .. -sudo rm -r stupid-git-repo-dir -git clone https://some.github.url/stupid-git-repo-dir.git -cd stupid-git-repo-dir +sudo rm -r xarab-git +git clone https://some.github.url/xarab-git.git +cd xarab-git ``` -Thanks to Eric V. for this one. All complaints about the use of `sudo` in this joke can be directed to him. +Bu misala görə Eric V.-ə təşəkkür edirəm. Bu zarafatda `sudo` istifadəsinə dair bütün şikayətlər ona ünvanlana bilər. +Amma həqiqətən, əgər local branch'ın dağılıbsa, və bu vəziyyəti remote repo'daki son halına "git-approved" bir şəkildə geri qaytarmaq istiyirsinizsə, bunu eliyin, amma diqqətli olun, bu proses dağıdıcı və geri dönülməyən bir yoldur. -For real though, if your branch is sooo borked that you need to reset the state of your repo to be the same as the remote repo in a "git-approved" way, try this, but beware these are destructive and unrecoverable actions! ```git -# get the lastest state of origin +# origin'in son vəziyyəti git fetch origin git checkout master git reset --hard origin/master -# delete untracked files and directories +# izlənilməyən faylları və qovluqları silin git clean -d --force -# repeat checkout/reset/clean for each borked branch +# bütün branch'lar üçün bunu təkrar edin ``` \ No newline at end of file diff --git a/az/swears/tips/01-magic-time-machine.md b/az/swears/tips/01-magic-time-machine.md index b4af9d8f..6f9e3ffc 100644 --- a/az/swears/tips/01-magic-time-machine.md +++ b/az/swears/tips/01-magic-time-machine.md @@ -12,7 +12,7 @@ git reflog # Hər birinin HEAD@{index} formatında indeksi var # sıçıb bulamazdan əvvəlki təmiz vəziyyəti tap, git reset HEAD@{index} -# bu da sənə zaman maşını. +# bu da sənə zaman maşını ``` Siz bunu səhvən sildiyiniz bir şeyi geri qaytarmaq və ya sadəcə reponu pozan bəzi şeyləri silmək və ya pox kimi merge'ü geri qaytarmaq ya da hər şeyin işlədiyi vaxta geri qayıtmaq üçün istifadə edə bilərsiz. Mən `reflog`'u çox istifadə edirəm. Bunu buraya əlavə etməyi tövsiyyə edən hər kəsə təşəkkür edirəm. \ No newline at end of file diff --git a/az/swears/tips/03-change-last-commit-message.md b/az/swears/tips/03-change-last-commit-message.md index 5416421e..3e9c91c4 100644 --- a/az/swears/tips/03-change-last-commit-message.md +++ b/az/swears/tips/03-change-last-commit-message.md @@ -9,4 +9,4 @@ git commit --amend # commit mesajını dəyişdirmək üçün göstərişlərə əməl edin ``` -Soxduğumun commit mesajının format tələbləri. \ No newline at end of file +Soxduğumun commit mesajının format tələbləri... \ No newline at end of file diff --git a/az/swears/tips/04-accidental-commit-master.md b/az/swears/tips/04-accidental-commit-master.md index bf43a5cb..8af2c194 100644 --- a/az/swears/tips/04-accidental-commit-master.md +++ b/az/swears/tips/04-accidental-commit-master.md @@ -14,4 +14,4 @@ git checkout some-new-branch-name # yeni commit artıq bu branch'da yaşıyacaq :) ``` -Qeyd: əgər commit'i çoxdan public/shared repo'ya push etmisinizsə, və əvvəlcə başla şeyləri yoxlamısınızsa, bu işə yaramıyacaq, onun yerinə də `HEAD~` əvəzinə `git reset HEAD@{1-2-commit-əvvəl}` yoxluyun. Sonsuz qəm-kədər. Mənim bildiyimdən çox çox daha qısa yolları mənə məsləhət görən bir çox adam oldu. Hamısına çox təşəkkürlər! \ No newline at end of file +Qeyd: əgər commit'i çoxdan public/shared repo'ya push etmisinizsə, və əvvəlcə başqa şeyləri yoxlamısınızsa, bu işə yaramıyacaq, onun yerinə də `HEAD~` əvəzinə `git reset HEAD@{1-2-commit-əvvəl}` yoxlayın. Sonsuz qəm-kədər. Mənim bildiyimdən çox çox daha qısa yolları mənə məsləhət görən bir çox adam oldu. Hamısına çox təşəkkürlər! \ No newline at end of file diff --git a/az/swears/tips/07-undo-a-commit.md b/az/swears/tips/07-undo-a-commit.md index 08578c0f..85b5e295 100644 --- a/az/swears/tips/07-undo-a-commit.md +++ b/az/swears/tips/07-undo-a-commit.md @@ -18,4 +18,4 @@ git revert [kopyalanan hash] Bir dəyişikliyi geri almaq üçün dəyişən yerləri tapıb bir bir yeni fayllara kopyalamaq lazım deyilmiş! Əgər səhvən bug'ı commit etmisinizsə, `revert` ilə commit'i geri ala bilərsiniz. -Hətta, tüm bir commit'i geri almaq əvəzinə, tək bir fayl da geri ala bilərsiz! A düzdü, həqiqi git metoduna görə, hər sikiş funksiyanın fərqlı komandası var... \ No newline at end of file +Hətta, tüm bir commit'i geri almaq əvəzinə, tək bir fayl da geri ala bilərsiz! A düzdü, həqiqi git metoduna görə, hər sikiş funksiyanın fərqli komandası var... \ No newline at end of file From 1d0da3ab45994180fac595d57f49bb084af8495e Mon Sep 17 00:00:00 2001 From: kazimovzaman2 Date: Tue, 23 Jan 2024 16:07:14 +0400 Subject: [PATCH 12/12] Add redirects --- _redirects | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/_redirects b/_redirects index fa7cd490..8e8ff9fb 100644 --- a/_redirects +++ b/_redirects @@ -229,3 +229,11 @@ https://ohshitgit.com/ https://ohshitgit.com/fa 302 Language=fa # persian no swears https://dangitgit.com/fa https://dangitgit.com/fa/noswears/index.html 200! https://dangitgit.com/ https://dangitgit.com/fa 302 Language=fa + +# azerbaijani swears +https://ohshitgit.com/az https://ohshitgit.com/az/swears/index.html 200! +https://ohshitgit.com/ https://ohshitgit.com/fa 302 Language=az + +# azerbaijani no swears +https://dangitgit.com/az https://dangitgit.com/az/noswears/index.html 200! +https://dangitgit.com/ https://dangitgit.com/fa 302 Language=az