Git کمانڈز چیٹ شیٹ

Git آپ کی فائلوں کی تبدیلیوں کو ریپوزٹری میں کمٹ کی ایک سیریز کے طور پر ٹریک کرتا ہے۔ یہ کمانڈز روزمرہ کے ورک فلو کو کور کرتے ہیں: ریپو بنانا، کام سیو کرنا، برانچ بنانا، مرج کرنا اور ریموٹ کے ساتھ شیئر کرنا۔ سیکھتے وقت شیٹ کھुلی رکھیں۔

اپ ڈیٹ:

کمانڈکیا کرتی ہے
git initCreate a new, empty Git repository in the current directory.
git cloneDownload a remote repository and its full history to your machine.
git statusShow changed, staged and untracked files in the working tree.
git addStage changes (files) to be included in the next commit.
git commitRecord staged changes as a new commit with a message.
git logDisplay the commit history of the repository.
git diffShow unstaged or staged differences between states.
git branchList, create or delete branches in the repository.
git checkout / switchSwitch branches or restore files (switch is the modern command).
git mergeJoin another branch's history into the current branch.
git rebaseReapply commits on top of another base commit, rewriting history.
git pullFetch from a remote and merge the changes into the current branch.
git pushUpload local commits to a remote repository.
git stashTemporarily shelve uncommitted changes to reapply later.
git remoteManage the set of remote repositories you track.

نوٹس

اکثر پوچھے گئے سوالات

merge اور rebase میں کیا فرق ہے؟
merge دو والدین والے ایک نئے کمٹ سے تاریخوں کو ملاتا ہے۔ rebase آپ کے کمٹ کو کسی اور برانچ کے اوپر دوبارہ چلاتا ہے، جس سے لینیئر تاریخ بنتی ہے لیکن کمٹ ID دوبارہ لکھی جاتی ہیں۔
میں کسی کمٹ کو کیسے واپس لوں؟
'git revert <کمٹ>' استعمال کریں تاکہ تبدیلی کو کالعدم کرنے والا ایک نیا کمٹ شامل ہو (محفوظ، شیئر شدہ تاریخ برقرار)۔ 'git reset' تاریخ کو دوبارہ لکھتا ہے، شیئر برانچ پر استعمال نہ کریں۔
git pull اور git fetch میں فرق کیا ہے؟
fetch ریموٹ سے کمٹ اور ریفرنس بغیر ورکنگ ٹری کو چھुए ڈاؤنلوڈ کرتا ہے۔ pull پہلے fetch کرتا ہے پھر ان تبدیلیوں کو موجودہ برانچ میں مرج یا ریبیس کرتا ہے۔
git stash کب استعمال کریں؟
stash کمٹ نہ کی گئی تبدیلیوں کو عارضی طور پر الگ رکھتا ہے تاکہ آپ صاف ستھرا برانچ بدل یا پل کر سکیں، پھر 'git stash pop' سے بحال کریں۔