diff --git a/_data/site.js b/_data/site.js index 33e63cb..e5b2ea2 100644 --- a/_data/site.js +++ b/_data/site.js @@ -33,6 +33,11 @@ module.exports = { code: "es", arialabel: "Mira en otro idioma", }, + { + label: "اردو", + code: "ur", + arialabel: "دوسری زبانوں میں دیکھیں", + }, { label: "français", code: "fr", @@ -165,6 +170,11 @@ module.exports = { link: "https://github.com/pReya", lang: "de", }, + { + name: "Muhammad Zulqarnain", + link: "https://github.com/Mzaq1559", + lang: "ur", + }, { name: "Daniil Golubev", link: "https://github.com/dadyarri", diff --git a/_redirects b/_redirects index fa7cd49..0800d84 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 + +# urdu swears +https://ohshitgit.com/ur https://ohshitgit.com/ur/swears/index.html 200! +https://ohshitgit.com/ https://ohshitgit.com/ur 302 Language=ur + +# urdu no swears +https://dangitgit.com/ur https://dangitgit.com/ur/noswears/index.html 200! +https://dangitgit.com/ https://dangitgit.com/ur 302 Language=ur \ No newline at end of file diff --git a/ur/noswears/index.html b/ur/noswears/index.html new file mode 100644 index 0000000..76989f6 --- /dev/null +++ b/ur/noswears/index.html @@ -0,0 +1,7 @@ +--- +layout: layouts/page.njk +locale: ur +dir: rtl +contentType: noswears +title: Dangit, Git!?! +--- diff --git a/ur/noswears/partials/banner.njk b/ur/noswears/partials/banner.njk new file mode 100644 index 0000000..6dc1b76 --- /dev/null +++ b/ur/noswears/partials/banner.njk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ur/noswears/partials/footer.njk b/ur/noswears/partials/footer.njk new file mode 100644 index 0000000..c412e03 --- /dev/null +++ b/ur/noswears/partials/footer.njk @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/ur/noswears/partials/intro.njk b/ur/noswears/partials/intro.njk new file mode 100644 index 0000000..2309839 --- /dev/null +++ b/ur/noswears/partials/intro.njk @@ -0,0 +1,2 @@ +

Git مشکل ہے: غلطی کرنا آسان ہے، اور اپنی غلطیوں کو ٹھیک کرنے کا طریقہ ڈھونڈنا بہت مشکل ہو جاتا ہے۔ Git کی documentation میں ایک عجیب مسئلہ ہے — جب تک آپ کو پہلے سے معلوم نہ ہو کہ آپ کو کیا ڈھونڈنا ہے، آپ اپنی پریشانی کا حل نہیں تلاش کر سکتے۔

+

تو یہ رہے کچھ ایسے مواقع جب میں خود پھنسا، اور یہ ہے کہ میں نے انہیں عام زبان میں کیسے حل کیا۔

diff --git a/ur/noswears/partials/outro.njk b/ur/noswears/partials/outro.njk new file mode 100644 index 0000000..63364b6 --- /dev/null +++ b/ur/noswears/partials/outro.njk @@ -0,0 +1 @@ +

*disclaimer: یہ site کوئی مکمل reference نہیں ہے۔ ہاں، یہ کام اور طریقوں سے بھی ہو سکتے ہیں، لیکن میں نے یہ steps آزما آزما کر، بہت گالیاں دے کر، اور میز پلٹ کر سیکھے ہیں۔ لیں یا چھوڑیں!

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

ان تمام لوگوں کا بہت شکریہ جنہوں نے site کو نئی زبانوں میں ترجمہ کرنے کے لیے وقت دیا، آپ کمال ہیں! +{% include "partials/collaborator-list.njk" %}. اضافی مدد سے {% include "partials/otherhelper-list.njk" %}

+ +

اگر آپ اپنی زبان میں ترجمہ شامل کرنا چاہتے ہیں تو {% github_link %} پر PR بھیجیں

\ No newline at end of file diff --git a/ur/noswears/tips/01-magic-time-machine.md b/ur/noswears/tips/01-magic-time-machine.md new file mode 100644 index 0000000..687e3be --- /dev/null +++ b/ur/noswears/tips/01-magic-time-machine.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: ارے یار، میں نے کچھ بہت غلط کر دیا — کیا git کے پاس ٹائم مشین ہے!?! +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/ur/noswears/tips/02-change-last-commit.md b/ur/noswears/tips/02-change-last-commit.md new file mode 100644 index 0000000..57c869e --- /dev/null +++ b/ur/noswears/tips/02-change-last-commit.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: ارے یار، میں نے ابھی commit کیا اور فوراً ایک چھوٹی سی تبدیلی کرنی پڑ گئی! +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/ur/noswears/tips/03-change-last-commit-message.md b/ur/noswears/tips/03-change-last-commit-message.md new file mode 100644 index 0000000..cf9cf0c --- /dev/null +++ b/ur/noswears/tips/03-change-last-commit-message.md @@ -0,0 +1,12 @@ +--- +tags: tip +title: ارے یار، مجھے اپنے آخری 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/ur/noswears/tips/04-accidental-commit-master.md b/ur/noswears/tips/04-accidental-commit-master.md new file mode 100644 index 0000000..59c5bef --- /dev/null +++ b/ur/noswears/tips/04-accidental-commit-master.md @@ -0,0 +1,17 @@ +--- +tags: tip +title: ارے یار، میں نے غلطی سے master پر commit کر دیا جو نئی 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/ur/noswears/tips/05-accidental-commit-wrong-branch.md b/ur/noswears/tips/05-accidental-commit-wrong-branch.md new file mode 100644 index 0000000..6a67225 --- /dev/null +++ b/ur/noswears/tips/05-accidental-commit-wrong-branch.md @@ -0,0 +1,29 @@ +--- +tags: tip +title: ارے یار، میں نے غلط branch پر commit کر دیا! +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/ur/noswears/tips/06-dude-wheres-my-diff.md b/ur/noswears/tips/06-dude-wheres-my-diff.md new file mode 100644 index 0000000..357cdd8 --- /dev/null +++ b/ur/noswears/tips/06-dude-wheres-my-diff.md @@ -0,0 +1,14 @@ +--- +tags: tip +title: ارے یار، میں نے diff چلایا مگر کچھ نظر نہیں آیا! +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/ur/noswears/tips/07-undo-a-commit.md b/ur/noswears/tips/07-undo-a-commit.md new file mode 100644 index 0000000..1fc61ba --- /dev/null +++ b/ur/noswears/tips/07-undo-a-commit.md @@ -0,0 +1,21 @@ +--- +tags: tip +title: ارے یار، مجھے 5 commits پہلے والا commit واپس لینا ہے! +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/ur/noswears/tips/08-undo-a-file.md b/ur/noswears/tips/08-undo-a-file.md new file mode 100644 index 0000000..5f09034 --- /dev/null +++ b/ur/noswears/tips/08-undo-a-file.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: ارے یار، مجھے کسی فائل میں کی گئی تبدیلیاں واپس لینی ہیں! +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/ur/noswears/tips/20-fuck-this-noise.md b/ur/noswears/tips/20-fuck-this-noise.md new file mode 100644 index 0000000..579a401 --- /dev/null +++ b/ur/noswears/tips/20-fuck-this-noise.md @@ -0,0 +1,29 @@ +--- +tags: tip +title: ارے یار، میں تھک گیا ہوں۔ +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/ur/noswears/tips/tips.json b/ur/noswears/tips/tips.json new file mode 100644 index 0000000..d0b2aa6 --- /dev/null +++ b/ur/noswears/tips/tips.json @@ -0,0 +1 @@ +{ "permalink": false } diff --git a/ur/swears/index.html b/ur/swears/index.html new file mode 100644 index 0000000..99070ec --- /dev/null +++ b/ur/swears/index.html @@ -0,0 +1,7 @@ +--- +layout: layouts/page.njk +locale: ur +dir: rtl +contentType: swears +title: Oh Shit, Git!?! +--- diff --git a/ur/swears/partials/banner.njk b/ur/swears/partials/banner.njk new file mode 100644 index 0000000..c36708f --- /dev/null +++ b/ur/swears/partials/banner.njk @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ur/swears/partials/footer.njk b/ur/swears/partials/footer.njk new file mode 100644 index 0000000..cecd704 --- /dev/null +++ b/ur/swears/partials/footer.njk @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/ur/swears/partials/intro.njk b/ur/swears/partials/intro.njk new file mode 100644 index 0000000..973516d --- /dev/null +++ b/ur/swears/partials/intro.njk @@ -0,0 +1,2 @@ +

Git مشکل ہے: غلطی کرنا آسان ہے، اور اپنی غلطیوں کو ٹھیک کرنے کا طریقہ ڈھونڈنا بالکل ناممکن لگتا ہے۔ Git کی documentation میں ایک عجیب مسئلہ ہے — جب تک آپ کو پہلے سے معلوم نہ ہو کہ آپ کو کیا ڈھونڈنا ہے، آپ اپنی مصیبت کا حل نہیں تلاش کر سکتے۔

+

تو یہ رہے کچھ ایسے مواقع جب میں خود پھنسا، اور یہ ہے کہ میں نے انہیں عام زبان میں کیسے حل کیا۔

diff --git a/ur/swears/partials/outro.njk b/ur/swears/partials/outro.njk new file mode 100644 index 0000000..512eb1a --- /dev/null +++ b/ur/swears/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 and profanity. Take it or leave it as you will!

\ No newline at end of file diff --git a/ur/swears/partials/thanks.njk b/ur/swears/partials/thanks.njk new file mode 100644 index 0000000..e4e21c8 --- /dev/null +++ b/ur/swears/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/ur/swears/tips/01-magic-time-machine.md b/ur/swears/tips/01-magic-time-machine.md new file mode 100644 index 0000000..d46923b --- /dev/null +++ b/ur/swears/tips/01-magic-time-machine.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: اوہ شٹ، میں نے کچھ بہت غلط کر دیا — کیا git کے پاس ٹائم مشین ہے!?! +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/ur/swears/tips/02-change-last-commit.md b/ur/swears/tips/02-change-last-commit.md new file mode 100644 index 0000000..8d499a9 --- /dev/null +++ b/ur/swears/tips/02-change-last-commit.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: اوہ شٹ، میں نے ابھی commit کیا اور فوراً ایک چھوٹی سی تبدیلی کرنی پڑ گئی! +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/ur/swears/tips/03-change-last-commit-message.md b/ur/swears/tips/03-change-last-commit-message.md new file mode 100644 index 0000000..da74188 --- /dev/null +++ b/ur/swears/tips/03-change-last-commit-message.md @@ -0,0 +1,12 @@ +--- +tags: tip +title: اوہ شٹ، مجھے اپنے آخری 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/ur/swears/tips/04-accidental-commit-master.md b/ur/swears/tips/04-accidental-commit-master.md new file mode 100644 index 0000000..18e5a30 --- /dev/null +++ b/ur/swears/tips/04-accidental-commit-master.md @@ -0,0 +1,17 @@ +--- +tags: tip +title: اوہ شٹ، میں نے غلطی سے master پر commit کر دیا جو نئی 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/ur/swears/tips/05-accidental-commit-wrong-branch.md b/ur/swears/tips/05-accidental-commit-wrong-branch.md new file mode 100644 index 0000000..6c39c13 --- /dev/null +++ b/ur/swears/tips/05-accidental-commit-wrong-branch.md @@ -0,0 +1,29 @@ +--- +tags: tip +title: اوہ شٹ، میں نے غلط branch پر commit کر دیا! +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/ur/swears/tips/06-dude-wheres-my-diff.md b/ur/swears/tips/06-dude-wheres-my-diff.md new file mode 100644 index 0000000..c9c181b --- /dev/null +++ b/ur/swears/tips/06-dude-wheres-my-diff.md @@ -0,0 +1,14 @@ +--- +tags: tip +title: اوہ شٹ، میں نے diff چلایا مگر کچھ نظر نہیں آیا! +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/ur/swears/tips/07-undo-a-commit.md b/ur/swears/tips/07-undo-a-commit.md new file mode 100644 index 0000000..d0ff0a8 --- /dev/null +++ b/ur/swears/tips/07-undo-a-commit.md @@ -0,0 +1,21 @@ +--- +tags: tip +title: اوہ شٹ، مجھے 5 commits پہلے والا commit واپس لینا ہے! +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/ur/swears/tips/08-undo-a-file.md b/ur/swears/tips/08-undo-a-file.md new file mode 100644 index 0000000..3cb5cb0 --- /dev/null +++ b/ur/swears/tips/08-undo-a-file.md @@ -0,0 +1,18 @@ +--- +tags: tip +title: اوہ شٹ، مجھے کسی فائل میں کی گئی تبدیلیاں واپس لینی ہیں! +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/ur/swears/tips/20-fuck-this-noise.md b/ur/swears/tips/20-fuck-this-noise.md new file mode 100644 index 0000000..0b9fb08 --- /dev/null +++ b/ur/swears/tips/20-fuck-this-noise.md @@ -0,0 +1,29 @@ +--- +tags: tip +title: بس کرو یہ سب، میں نے ہار مان لی۔ +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/ur/swears/tips/tips.json b/ur/swears/tips/tips.json new file mode 100644 index 0000000..d0b2aa6 --- /dev/null +++ b/ur/swears/tips/tips.json @@ -0,0 +1 @@ +{ "permalink": false }