CodeBlanks Logo Icon CodeBlanks

After cloning

Learn how branches and history arrive after cloning.

Origin After Cloning

When you download a GitHub repository using git clone, Git automatically registers the source remote repository under the name origin. Therefore, you usually do not need to run git remote add separately.

git clone https://github.com/ayse/site.git
git remote -v

After cloning, origin represents the remote repository address. You can view this connection using git remote -v.

Branches and Commit History

Cloning does not only download files; it also transfers the repository's commit history and branch information to the local copy. The default branch is automatically checked out in the cloned repository.

git branch
git log --oneline

git branch lists local branches, while git log --oneline displays the commit history in a compact format. This lets you inspect the current branch and history before starting work.

Practice Inspect the Repository After Cloning

After cloning a repository, inspect its remote connections, local branches, and commit history. Write the commands git remote -v, git branch, and git log --oneline in that order.

Starter code

terminal
# Uzak bağlantıları görüntüle

# Yerel dalları listele

# Commit geçmişini görüntüle

Sample solution

terminal
git remote -v
git branch
git log --oneline

Expected output

origin
git branch
git log --oneline

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Under which default name is the source remote registered when you clone a repository with git clone?

  • origin Correct answer
  • master
  • upstream
  • main

Explanation: Git automatically registers the source remote under the name <code>origin</code> when cloning.

2 Display the Remote Name of a Cloned Repository

Question
git remote ____
Answer
git remote -v

Explanation: <code>git remote -v</code> displays the automatically added remote connection and its addresses in the cloned repository.

3 Repository After Cloning

Term Meaning
origin Source remote name
Varsayılan dal Initially active branch
git branch Lists local branches
git log --oneline Shows compact commit history

All lessons in Beginner