Skip to content

Commit 583db85

Browse files
MSafariyanDavoodeh
authored andcommitted
Translate undoing section
1 parent 9819987 commit 583db85

File tree

1 file changed

+56
-40
lines changed

1 file changed

+56
-40
lines changed

book/02-git-basics/sections/undoing.asc

Lines changed: 56 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,25 @@
66
توجه کنید، شما همین این برگشتها را نمی توانید دوباره برگشت کنید.
77
اینجا یکی از معدود جاهایی است که اگر حواستان جمع نباشد امکان دارد داده ای از دست برود.
88

9-
One of the common undos takes place when you commit too early and possibly forget to add some files, or you mess up your commit message.
10-
If you want to redo that commit, make the additional changes you forgot, stage them, and commit again using the `--amend` option:
9+
یکی از متداول ترین بازگشت‌ها زمانی است که شما کامیتی خیلی زود انجام دادید و احتمالا اضافه کردن چند فایل‌ را فراموش کردید یا
10+
در پیام کامیتتان خطایی رخ داده باشد.
11+
اگر شما بخواهید کامیت را «ریدو» کنید، تغییرات اضافه فراموش شده را اعمال کنید، آنان را استیج کنید و دوباره با استفاده از آپشن
12+
`amend--` دوباره کامیت کنید:
1113

1214
[source,console]
1315
----
1416
$ git commit --amend
1517
----
1618

17-
This command takes your staging area and uses it for the commit.
18-
If you've made no changes since your last commit (for instance, you run this command immediately after your previous commit), then your snapshot will look exactly the same, and all you'll change is your commit message.
19+
این دستوری که انجام می‌دهید وارد منطقه استیج می‌شود و برای کامیت کردن استفاده می‌شود.
20+
اگه از اخرین کامیتتان هیچ تغییری ایجاد نکرده باشید(برای مثال، شما دستور را به محض انجام کامیت قبلی اجرا می‌کنید)، سپس اسنپ‌شات شما
21+
دقیقا به یک شکل است و تمام چیزی که تغییر می‌کند فقط پیام کامیت شما است و نه چیز دیگری.
1922

20-
The same commit-message editor fires up, but it already contains the message of your previous commit.
21-
You can edit the message the same as always, but it overwrites your previous commit.
23+
همان ویرایشگر پیام کامیت بالا می‌آید، اما در حال حاضر شما پیام کامیت قبلی است.
24+
شما می‌توانید پیام را مانند همیشه اصلاح کنید، اما این عمل بر روی کامیت قبلی بازنویسی می‌شود.
2225

23-
As an example, if you commit and then realize you forgot to stage the changes in a file you wanted to add to this commit, you can do something like this:
26+
برای مثال، اگر شما کامیت کنید و سپس متوجه شوید که چیزی را فراموش کردید و میخواستید آن را استیج کنید و به همین کامیت اضافه کنید،
27+
شما می‌توانید چنین کاری را انجام دهید:
2428

2529
[source,console]
2630
----
@@ -29,24 +33,28 @@ $ git add forgotten_file
2933
$ git commit --amend
3034
----
3135

32-
You end up with a single commit -- the second commit replaces the results of the first.
36+
در نهایت کار شما با یک کامیت به پایان می‌رسد -- کامیت دوم جایگزین نتایج کامیت اول می‌شود.
3337

3438
[NOTE]
3539
====
36-
It's important to understand that when you're amending your last commit, you're not so much fixing it as _replacing_ it entirely with a new, improved commit that pushes the old commit out of the way and puts the new commit in its place.
37-
Effectively, it's as if the previous commit never happened, and it won't show up in your repository history.
40+
خیلی مهم است که بدانید که وقتی درحال امند کردن اخرین کامیت هستید، درواقع شما آن را با استفاده عمل _جایگزین‌_ تعمیر نمی‌کنید بلکه
41+
یه ورودی جدید میسازید، کامیت بهبود یافته، کامیت قدیمی را کنار میزند و جایگزین آن می‌شود.
42+
همانطور که انتظار داشتیم، انگار قبلا هیچ کامیت غلطی وجود نداشته و هیچ وقت در تاریخچه‌ی مخزن شما نمایش داده نمی‌شود.
3843
39-
The obvious value to amending commits is to make minor improvements to your last commit, without cluttering your repository history with commit messages of the form, ``Oops, forgot to add a file'' or ``Darn, fixing a typo in last commit''.
44+
فایده مشخص امند کردن کامیت‌ها این است که یک تغییر خیلی جزئی برای اخرید کامیت می‌سازید،‌ بدون ایجاد درهم ریختگی در تاریخچه‌ی مخزن شما
45+
و جلوگیری از کامیت‌های با پیام‌های این‌چنینی، ``اوه، اضافه کردن یک فایل فراموش شده بود‍‍'' اصلاح یک غلط املایی در کامیت آخر''``.
4046
====
4147

4248
[[_unstaging]]
43-
==== Unstaging a Staged File
49+
==== آن‌استیج کردن یک فایل استیج شده
4450

45-
The next two sections demonstrate how to work with your staging area and working directory changes.
46-
The nice part is that the command you use to determine the state of those two areas also reminds you how to undo changes to them.
47-
For example, let's say you've changed two files and want to commit them as two separate changes, but you accidentally type `git add *` and stage them both.
48-
How can you unstage one of the two?
49-
The `git status` command reminds you:
51+
دو قسمت بعدی درباره چگونگی کار با بخش استیج و تغیرات پوشه کاری توضیح می‌دهد.
52+
قسمت قشنگ است که شما دستوری که شما استفاده می‌کنید برای تعیین وضعیت آن دو بخش که بالا گفته شد همچنین یاد‌آوری می‌کند که چگونه
53+
تغییرات به عقب برگردانید.
54+
برای مثال، بیایید بگوییم شما دو فایل را تغییر داده بودید و مخوایید آن‌ها جدا از هم کامیت کنید، اما به کاملا تصادفی دستور `git add * `
55+
را وارد می‌کنید و هر دو آن‌ها استیج می‌شوند.
56+
چطور می‌توانید آن‌ها آن‌استیج کنید؟
57+
دستور `git status` به شما یادآوری می‌کند.
5058

5159
[source,console]
5260
----
@@ -60,8 +68,8 @@ Changes to be committed:
6068
modified: CONTRIBUTING.md
6169
----
6270

63-
Right below the ``Changes to be committed'' text, it says use `git reset HEAD <file>...` to unstage.
64-
So, let's use that advice to unstage the `CONTRIBUTING.md` file:
71+
دقیقا بالای متن ``Changes to be comitted``، به شما گفته از `git reset HEAD <file> ...` برای آن‌استیج استفاده کنید.
72+
پس بایید به توصیه گیت گوش کنیم و فایل `CONTRIBURING.md` را آن‌استیج کنیم:
6573

6674
[source,console]
6775
----
@@ -82,24 +90,27 @@ Changes not staged for commit:
8290
modified: CONTRIBUTING.md
8391
----
8492

85-
The command is a bit strange, but it works.
86-
The `CONTRIBUTING.md` file is modified but once again unstaged.
93+
دستور مقداری عجیب به نظر می‌رسد،‌ اما کار می‌کند.
94+
فایل `CONTRIBUTING.md` تغییر کرده است اما دوباره به حال آن‌استیج درآمده است.
8795

8896
[NOTE]
8997
=====
90-
It's true that `git reset` can be a dangerous command, especially if you provide the `--hard` flag.
91-
However, in the scenario described above, the file in your working directory is not touched, so it's relatively safe.
98+
این درست که دستور `git reset` می‌تواند خطرناک باشد، مخصوصا اگر از فلگ `hard--` استفاده کرده باشید.
99+
با این حال، در این سناریو که بالا توضیح داده شد، فایل در پوشه کاری شما قرار دارد متاثر خطرات نمی‌شود، پس امن است.
92100
=====
93101

94-
For now this magic invocation is all you need to know about the `git reset` command.
95-
We'll go into much more detail about what `reset` does and how to master it to do really interesting things in <<ch07-git-tools#_git_reset>>.
102+
در حال حاضر این توضیحات جادویی تمام چیزی بود که شما لازم داشتید تا درباره دستور `git reset` بدانید.
103+
بعد تر در بخش <<ch07-git-tools#_git_reset>> با جزئیات بیشتری وارد بحث `reset` می‌شویم که چه کاری می‌کن
104+
د و چطور می‌توان در آن استاد شد تا چیزهای واقعا جالب‌تری انجام داد.
96105

97-
==== Unmodifying a Modified File
98106

99-
What if you realize that you don't want to keep your changes to the `CONTRIBUTING.md` file?
100-
How can you easily unmodify it -- revert it back to what it looked like when you last committed (or initially cloned, or however you got it into your working directory)?
101-
Luckily, `git status` tells you how to do that, too.
102-
In the last example output, the unstaged area looks like this:
107+
==== بازگشت اصلاحات به قبل
108+
109+
چه می‌شود اگر بفهمید دیگر نمی‌خواهید تغییر فایل `COUNTRIBUTING.md` حفظ کنید؟
110+
چطور می‌شود تغییرات را به حالت قبل برگرداند -- بازگرداندن آن به همان شکل که در آخرین کامیت شما بود
111+
(یا کلون شده بود، یا همانگونه که وارد پوشه کاری شما شده بود).
112+
خوش‌بختانه، `git status` این را نیز به شما می‌گوید که چگونه آن را انجام دهید.
113+
در خروجی آخرین مثال، بخش آن‌استیج چیزی شبیه به این بود:
103114

104115
[source,console]
105116
----
@@ -110,8 +121,8 @@ Changes not staged for commit:
110121
modified: CONTRIBUTING.md
111122
----
112123

113-
It tells you pretty explicitly how to discard the changes you've made.
114-
Let's do what it says:
124+
این به شما به زیبایی و صراحت می‌گوید که تغییرات انجام شده را چگونه از بین ببریم.
125+
بزارید کاری که گفته شده را انجام دهیم:
115126

116127
[source,console]
117128
----
@@ -125,17 +136,22 @@ Changes to be committed:
125136
126137
----
127138

128-
You can see that the changes have been reverted.
139+
شما می‌‌توانید ببینید که تغییرات با حالت اول بازگشتند.
129140

130141
[IMPORTANT]
131142
=====
132-
It's important to understand that `git checkout -- <file>` is a dangerous command.
133-
Any local changes you made to that file are gone -- Git just replaced that file with the most recently-committed version.
134-
Don't ever use this command unless you absolutely know that you don't want those unsaved local changes.
143+
خیلی مهم است بدانید که دستور `git checkout -- <file>` دستور خطرناکی است.
144+
هر تغییری که محلی باشد و کامیت نشده باشد از بین خواهد رفت -- گیت تغییرات فایل‌ها را با آخرین نسخه کامیت‌ شده باز میگرداند.
145+
از این دستور تا زمانی که نمی‌دانید دقیقا واقعا می‌دانید که به آن تغییرات نیاز ندارید انجام ندهید.
135146
=====
136147

137-
If you would like to keep the changes you've made to that file but still need to get it out of the way for now, we'll go over stashing and branching in <<ch03-git-branching#ch03-git-branching>>; these are generally better ways to go.
148+
اگر مایل هستید تا تغییراتی که ایجاد کرده بودید را حفظ کنید اما در حال حاضر می‌خواید سر راهتان نباشند، شما باید از سراغ استش کردن و شاخه‌ها
149+
در بخش <<ch03-git-branching#ch03-git-branching>> بروید؛ به طور کلی این‌ها بهترین راه‌ها هستند.
150+
151+
یادتان باشد، هرچیزی که در گیت _کامیت‌_ شده باشد می‌تواند تقریبا همیشه بازگردانی شود.
152+
حتی کامیت‌هایی که بر روی شاخه‌هایی که حذف شده بودند وجود داشتند یا کامیت‌هایی که با فلگ `amend--` بازنویسی شده‌ بودند می‌توانند بازگردانی شوند.
153+
154+
155+
( بخش <<ch10-git-internals#_data_recovery>> را برای بازگردانی اطلاعات ببینید ).
138156

139-
Remember, anything that is _committed_ in Git can almost always be recovered.
140-
Even commits that were on branches that were deleted or commits that were overwritten with an `--amend` commit can be recovered (see <<ch10-git-internals#_data_recovery>> for data recovery).
141-
However, anything you lose that was never committed is likely never to be seen again.
157+
با این حال، هر چیزی که شما کامیت نکرده باشد و از دست دهید، انگار هیچ وقت آن‌ها را نساخته بودید.

0 commit comments

Comments
 (0)