متقدم
البحث فيالملخصات
طريقة البحث
  • الكلمات تجد عناوين الدروس والنص والكود. صفِّ حسب النوع (أدلة، دورات، برامج، كتب) أو ابقَ في هذا الكتاب.
  • book:rhcsa و ch:8 يضيّقان البحث؛ ‎#code يجد الكلمة داخل أوامر الدروس فقط.
  • "كلمتان" تجد العبارة بالضبط.
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث
جرّب:

الدورة 5الاسم في الدورة: Getting Started with Git and GitHub

Getting Started with Git and GitHub

Course 5 of 16 in the IBM DevOps and Software Engineering certificate. This is a self-paced first course on Git and GitHub.

ملاحظة

My result — Course completion: 100%; Grade: 100% (pass = 50%); Certificate: not offered on Cognitive Class for this edition.

Course page: Coursera · Cognitive Class

  • 11 الدروس
  • 2 الأوامر
  • 2 المعامل

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

5.1

What the course covers

Why teams need version control and what it protects.

  • The difference between Git (the tool) and GitHub (the website).
  • Creating a GitHub account and a first repository.
  • Commits, branches, and merging work.
  • The main commands: clone, fork, add, commit, push, pull.
  • A final project: one public GitHub repository with files and a license.
ModuleMain focus
Module 1 · about 2 hoursGit and GitHub Fundamentals: version control, repos, commits, branches, merge
Module 2 · about 2 hoursGit Commands and Managing GitHub Projects: clone, fork, push, pull, workflows
Module 3 · about 5 hoursFinal Project and Assessment: publish a public repo with files and a license
Module 4 · about 2 hoursOptional: working with GitHub from your Windows desktop (Git Bash, SSH)

5.2

Module 1: Git and GitHub Fundamentals

Git and GitHub Fundamentals: version control, repos, commits, branches, merge.

  • Version control: a system that records changes to files over time, so you can see old versions and go back.
  • A centralized system keeps history on one server. A distributed system, like Git, gives every user a full copy of the history.
  • Git is the tool on your computer. GitHub is a website that hosts Git repositories in the cloud.
  • Repository (repo): a project folder that Git tracks, with all of its change history.
  • Commit: a saved snapshot of your changes, with a message and an author; each commit has a unique ID (hash).
  • Branch: a separate line of work; use one branch per feature so main stays safe. Merge joins it back.
  • Pull request (PR): a request to review and merge your branch, the main teamwork tool on GitHub.
  • Issue: a GitHub note for a task, bug, or question; issues track work.
  • A change moves through three places: the working tree (your files), the staging area (changes picked for the next commit), and the repository (saved history).
  • A repo can be public (everyone sees it) or private (only invited people see it). Accounts are free.
  • Version control records changes to files over time.
  • You can see old versions and go back to them.
  • A centralized system keeps history on one server. Git is distributed: every user has a full copy.
  • Git is the tool on your computer. GitHub is a website that hosts repos.
  • A repository is a project folder with its full history.
  • A commit is a saved snapshot with a message and an author.
  • A branch is a separate line of work. A merge joins it back.
  • A pull request asks others to review and merge your branch.
  • An issue is a note for a task, bug, or question.
  • A change moves through the working tree, the staging area, and the repo.

5.3

Module 2: Git Commands and Managing GitHub Projects

Git Commands and Managing GitHub Projects: clone, fork, push, pull, workflows.

الأوامر في هذا الدرس

5.4

Module 3: Final Project and Assessment

Final Project and Assessment: publish a public repo with files and a license.

  • The final project asks for a public GitHub repo that looks like a real small project, with a few files (README, code, .gitignore).
  • Add an open-source license: Add file → Create new file, name it LICENSE. It says how others may reuse your code.
  • A README explains what the repo is, how to use it, and who made it. It is the first file visitors see.
  • The final project asks for a public GitHub repo.
  • It should look like a small real project: README, code, .gitignore.
  • Add a LICENSE file to say how others may reuse the code.
  • A README explains what the repo is, how to use it, and who made it.

5.5

Module 4: Optional: GitHub from Your Windows Desktop

Optional: working with GitHub from your Windows desktop (Git Bash, SSH).

  • Git Bash gives Windows users a Unix-like terminal with Git commands.
  • An SSH key is a key pair. You add the public key to GitHub, and then you push and pull without typing a password each time.
  • Keep the private key secret. Never share it or commit it.
  • Git Bash gives Windows a Unix-like terminal with Git.
  • An SSH key pair connects you to GitHub without a password each time.
  • Add the public key to GitHub, and keep the private key secret.

5.6

Course topics and key ideas

Git records changes to files over time.

  • GitHub hosts Git projects and team work.
  • Branching lets you work on a separate line of change.
  • Forking makes your own copy of another project.
  • Merging joins changes from different branches.
  • You can do the course work with no install.

Topics of the course

  • What version control is.
  • Git basics.
  • GitHub basics.
  • Branching.
  • Forking.
  • Merging.
  • Team work on GitHub.
  • Work with no software install.
  • Repositories and commits.
  • Pull requests.
  • Code review.
  • Issues and project boards.

Why it matters

  • Version control keeps a history of changes.
  • Branches let people try ideas without breaking the main code.
  • Pull requests make team review easier.
  • GitHub is used in many software teams.

5.7

Key terms

The words of this course in one table. Learn them before the quiz or exam.

TermMeaning
BranchA separate line of work.
CloneCopy a repo to your computer.
CommitA saved snapshot with a message.
ConflictWhen two changes touch the same line and Git needs help.
ForkCopy a repo to your own GitHub account.
GitA distributed version control tool.
git addStage a change.
git commitSave staged changes.
git pullGet new commits from the remote.
git pushSend commits to the remote.
GitHubA website that hosts Git repos.
HashThe unique ID of a commit.
IssueA note for a task, bug, or question.
Main branchThe default branch of a project.
mainThe usual name of the main branch.
MergeJoin a branch into another.
OriginThe usual name of your remote.
Pull requestA request to review and merge.
READMEThe front page of a repo.
RemoteA repository hosted on another server, such as GitHub.
RepositoryA tracked project folder with history.
Staging areaChanges picked for the next commit.
UpstreamThe original repo of a fork.
Version controlA record of file changes over time.
Working treeThe files you see and edit.

5.8

Check yourself

Answer each question first, then open it to check the answer.

1What is Git? a) A website for hosting projects · b) A distributed version control tool installed on your computer · c) A programming language · d) A text editor

b) A distributed version control tool installed on your computer. Git is the version control tool on your machine; GitHub is the website.

2What is GitHub? a) The same tool as Git, with a new name · b) A cloud service that hosts Git repositories · c) A Linux command for files · d) A Python library

b) A cloud service that hosts Git repositories. GitHub hosts Git repos in the cloud.

3Which statement about a commit is correct? a) It deletes the old version of a file · b) It is a saved snapshot of changes with a message · c) It renames a branch · d) It copies a repository to another account

b) It is a saved snapshot of changes with a message. A commit is a snapshot with a message and an author.

4Why do teams use branches? a) To make the repo smaller · b) To work on a feature without changing main · c) To delete files faster · d) To hide the project

b) To work on a feature without changing main. A branch lets you work without touching main until you merge.

5What is a pull request? a) A command that downloads a repo · b) A request to review and merge a branch · c) A type of license · d) A tool that installs Git

b) A request to review and merge a branch. A PR asks others to review your branch and merge it.

6Which command saves the staged changes as a snapshot? a) git push · b) git add · c) git commit -m "message" · d) git clone

c) git commit -m "message". git commit records what was added to the staging area.

7What is the difference between clone and fork? a) Clone copies to your computer; fork copies to your own GitHub account · b) Fork copies to your computer; clone copies to GitHub · c) They are the same action · d) Clone only works for private repos

a) Clone copies to your computer; fork copies to your own GitHub account. Clone = local copy. Fork = server-side copy in your own account.

8You forked a repo. What is the original repo called? a) origin · b) upstream · c) main · d) staging

b) upstream. The original repo is upstream; your fork is origin.

9Which command creates a new branch and switches to it? a) git merge my-branch · b) git checkout -b my-branch · c) git push my-branch · d) git pull my-branch

b) git checkout -b my-branch. -b creates the branch and moves you onto it.

10What should the final project repository be? a) Private and empty · b) Public, with a few files and a license · c) A fork of an IBM repo · d) Only one branch with no commits

b) Public, with a few files and a license. The project asks for a public repo with files and a license.

11Why does a public repo often include a LICENSE file? a) To store passwords · b) To tell people how they may reuse the code · c) To run the code faster · d) To hide the README

b) To tell people how they may reuse the code. A license states what others may do with your code.

12What is an SSH key used for in GitHub? a) To encrypt the README · b) To connect to GitHub safely without a password each time · c) To create a new GitHub account · d) To delete branches

b) To connect to GitHub safely without a password each time. The SSH key pair replaces password prompts for Git over SSH.

13What is Git? a) A website for hosting projects · b) A distributed version control tool on your computer · c) A programming language · d) A text editor

b) A distributed version control tool on your computer. Git is the version control tool on your machine.

14What is GitHub? a) The same tool as Git · b) A command in the terminal · c) A cloud service that hosts Git repositories · d) A Python library

c) A cloud service that hosts Git repositories. GitHub hosts Git repos in the cloud.

15What does version control let you do? a) See old versions and go back · b) Delete all history · c) Skip testing · d) Hide files from yourself

a) See old versions and go back. Version control keeps old versions for you.

16What is a repository? a) A single file · b) A server room · c) A license · d) A project folder that Git tracks with its history

d) A project folder that Git tracks with its history. A repo is a tracked folder with its history.

17What is a commit? a) A branch · b) A saved snapshot with a message · c) A remote · d) A license

b) A saved snapshot with a message. A commit is a snapshot with a message and an author.

18Why do teams use branches? a) To delete the repo · b) To hide the history · c) To work without changing main · d) To make the CPU faster

c) To work without changing main. A branch keeps main safe while you work.

19What is a pull request? a) A download command · b) A license · c) A type of commit · d) A request to review and merge a branch

d) A request to review and merge a branch. A PR asks others to review and merge your branch.

20What is an issue? a) A note for a task, bug, or question · b) A branch · c) A remote · d) A key

a) A note for a task, bug, or question. Issues track tasks, bugs, and questions.

21What does git status show? a) The license · b) Changed and staged files · c) Only the remote URL · d) The team chat

b) Changed and staged files. Status shows changed and staged files.

22What does git add . do? a) Commits all changes · b) Pushes all changes · c) Stages all changes · d) Deletes all changes

c) Stages all changes. The dot stages every change in the folder.

23Which command saves the staged changes as a snapshot? a) git commit -m "message" · b) git add · c) git status · d) git clone

a) git commit -m "message". Commit records what you staged.

24Where does git push send your commits? a) To the README · b) To the license · c) To the trash · d) To the hosted remote

d) To the hosted remote. Push sends commits to the remote repo.

25What does git pull do? a) Sends commits up · b) Brings new commits from the remote · c) Creates a branch · d) Deletes the history

b) Brings new commits from the remote. Pull brings new commits down to you.

26What does git checkout -b new-branch do? a) Deletes a branch · b) Merges a branch · c) Creates a branch and switches to it · d) Lists branches

c) Creates a branch and switches to it. The -b flag creates and switches in one step.

27What does clone mean? a) Copy a repo to your computer · b) Copy a repo to your GitHub account · c) Delete a repo · d) Rename a repo

a) Copy a repo to your computer. Clone makes a local copy.

28What does fork mean? a) Copy a repo to your computer · b) Make a branch · c) Make a commit · d) Copy a repo to your own GitHub account

d) Copy a repo to your own GitHub account. Fork makes a copy under your account.

29What is origin? a) The license · b) The branch · c) The usual name of your remote · d) The commit

c) The usual name of your remote. Origin is the default name for your remote.

30What does a LICENSE file say? a) How others may reuse the code · b) The password · c) The test plan · d) The server name

a) How others may reuse the code. A license states the reuse rules.

31What should a README explain? a) The private key · b) The office address · c) The salary · d) What the repo is and how to use it

d) What the repo is and how to use it. A README tells visitors what the repo does.

32What does Git record?

It records changes to files over time.

33What is a fork?

It is your own copy of another project.

34What does merging do?

It joins changes from different branches.

الأوامر في هذا الدرس

5.9

Study and exam tips

Keep Git and GitHub apart in your mind. Git = local tool. GitHub = cloud hosting.

  • Learn the order: edit → git add → git commit → git push.
  • Know clone vs fork cold; the two words are easy to mix up.
  • Remember the final project needs: a public repo, a few files, a license, a README.
  • Most lab work uses the GitHub web UI, so a local Git install is not required to pass.
  • Keep Git and GitHub apart. Git = local tool. GitHub = cloud hosting.
  • The final project needs a public repo, a few files, a license, and a README.
  • Most labs use the GitHub web UI, so a local Git install is not required.

الأوامر في هذا الدرس

تدرّب

كل الأوامر في هذا الفصل