Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions _data/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ module.exports = {
code: "es",
arialabel: "Mira en otro idioma",
},
{
label: "اردو",
code: "ur",
arialabel: "دوسری زبانوں میں دیکھیں",
},
{
label: "français",
code: "fr",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions _redirects
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions ur/noswears/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout: layouts/page.njk
locale: ur
dir: rtl
contentType: noswears
title: Dangit, Git!?!
---
1 change: 1 addition & 0 deletions ur/noswears/partials/banner.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<aside class="notice">ہیلو! آپ یہی مواد بغیر گالیوں کے <a href="{{site.url_noswears}}/{{locale}}">dangitgit.com</a> پر دیکھ سکتے ہیں</aside>
5 changes: 5 additions & 0 deletions ur/noswears/partials/footer.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<footer>
<small class="contact">آپ کا کوئی "اوہ شٹ git" والا لمحہ ہے؟ مجھے بتائیں!</small>
<small class="twitter">{% twitter_link "ohshitgit" %} {% twitter_link "ksylor" %}</small>
<small class="copyright">{{site.copyright | safe}}</small>
</footer>
2 changes: 2 additions & 0 deletions ur/noswears/partials/intro.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<p>Git مشکل ہے: غلطی کرنا آسان ہے، اور اپنی غلطیوں کو ٹھیک کرنے کا طریقہ ڈھونڈنا بہت مشکل ہو جاتا ہے۔ Git کی documentation میں ایک عجیب مسئلہ ہے — جب تک آپ کو پہلے سے معلوم نہ ہو کہ <em>آپ کو کیا ڈھونڈنا ہے</em>، آپ اپنی پریشانی کا حل نہیں تلاش کر سکتے۔</p>
<p>تو یہ رہے کچھ ایسے مواقع جب میں خود پھنسا، اور یہ ہے کہ میں نے انہیں <em>عام زبان میں</em> کیسے حل کیا۔</p>
1 change: 1 addition & 0 deletions ur/noswears/partials/outro.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>*disclaimer: یہ site کوئی مکمل reference نہیں ہے۔ ہاں، یہ کام اور طریقوں سے بھی ہو سکتے ہیں، لیکن میں نے یہ steps آزما آزما کر، بہت گالیاں دے کر، اور میز پلٹ کر سیکھے ہیں۔ لیں یا چھوڑیں!</p>
4 changes: 4 additions & 0 deletions ur/noswears/partials/thanks.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<p>ان تمام لوگوں کا بہت شکریہ جنہوں نے site کو نئی زبانوں میں ترجمہ کرنے کے لیے وقت دیا، آپ کمال ہیں!
{% include "partials/collaborator-list.njk" %}. اضافی مدد سے {% include "partials/otherhelper-list.njk" %}</p>

<p>اگر آپ اپنی زبان میں ترجمہ شامل کرنا چاہتے ہیں تو {% github_link %} پر PR بھیجیں</p>
18 changes: 18 additions & 0 deletions ur/noswears/tips/01-magic-time-machine.md
Original file line number Diff line number Diff line change
@@ -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!
18 changes: 18 additions & 0 deletions ur/noswears/tips/02-change-last-commit.md
Original file line number Diff line number Diff line change
@@ -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.*
12 changes: 12 additions & 0 deletions ur/noswears/tips/03-change-last-commit-message.md
Original file line number Diff line number Diff line change
@@ -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.
17 changes: 17 additions & 0 deletions ur/noswears/tips/04-accidental-commit-master.md
Original file line number Diff line number Diff line change
@@ -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!
29 changes: 29 additions & 0 deletions ur/noswears/tips/05-accidental-commit-wrong-branch.md
Original file line number Diff line number Diff line change
@@ -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
```
14 changes: 14 additions & 0 deletions ur/noswears/tips/06-dude-wheres-my-diff.md
Original file line number Diff line number Diff line change
@@ -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 &macr;\\\_(ツ)\_/&macr; (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!)
21 changes: 21 additions & 0 deletions ur/noswears/tips/07-undo-a-commit.md
Original file line number Diff line number Diff line change
@@ -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...
18 changes: 18 additions & 0 deletions ur/noswears/tips/08-undo-a-file.md
Original file line number Diff line number Diff line change
@@ -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:
29 changes: 29 additions & 0 deletions ur/noswears/tips/20-fuck-this-noise.md
Original file line number Diff line number Diff line change
@@ -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
```
1 change: 1 addition & 0 deletions ur/noswears/tips/tips.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "permalink": false }
7 changes: 7 additions & 0 deletions ur/swears/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout: layouts/page.njk
locale: ur
dir: rtl
contentType: swears
title: Oh Shit, Git!?!
---
1 change: 1 addition & 0 deletions ur/swears/partials/banner.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<aside class="notice">Hi there! You can get this same content without swears at <a href="{{site.url_noswears}}/{{locale}}">dangitgit.com</a></aside>
5 changes: 5 additions & 0 deletions ur/swears/partials/footer.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<footer>
<small class="contact">What's your Oh shit, git moment? Share it with me!</small>
<small class="twitter">{% twitter_link "ohshitgit" %} {% twitter_link "ksylor" %}</small>
<small class="copyright">{{site.copyright | safe}}</small>
</footer>
2 changes: 2 additions & 0 deletions ur/swears/partials/intro.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<p>Git مشکل ہے: غلطی کرنا آسان ہے، اور اپنی غلطیوں کو ٹھیک کرنے کا طریقہ ڈھونڈنا بالکل ناممکن لگتا ہے۔ Git کی documentation میں ایک عجیب مسئلہ ہے — جب تک آپ کو پہلے سے معلوم نہ ہو کہ <em>آپ کو کیا ڈھونڈنا ہے</em>، آپ اپنی مصیبت کا حل نہیں تلاش کر سکتے۔</p>
<p>تو یہ رہے کچھ ایسے مواقع جب میں خود پھنسا، اور یہ ہے کہ میں نے انہیں <em>عام زبان میں</em> کیسے حل کیا۔</p>
1 change: 1 addition & 0 deletions ur/swears/partials/outro.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>*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!</p>
4 changes: 4 additions & 0 deletions ur/swears/partials/thanks.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<p>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" %}</p>

<p>If you'd like to help add a translation into your language, submit a PR on {% github_link %}</p>
18 changes: 18 additions & 0 deletions ur/swears/tips/01-magic-time-machine.md
Original file line number Diff line number Diff line change
@@ -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!
18 changes: 18 additions & 0 deletions ur/swears/tips/02-change-last-commit.md
Original file line number Diff line number Diff line change
@@ -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.*
12 changes: 12 additions & 0 deletions ur/swears/tips/03-change-last-commit-message.md
Original file line number Diff line number Diff line change
@@ -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.
17 changes: 17 additions & 0 deletions ur/swears/tips/04-accidental-commit-master.md
Original file line number Diff line number Diff line change
@@ -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!
29 changes: 29 additions & 0 deletions ur/swears/tips/05-accidental-commit-wrong-branch.md
Original file line number Diff line number Diff line change
@@ -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
```
Loading