Basic Git commands Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Initializes a brand new Git repository and begins tracking an existing directory. It adds a hidden subfolder within the existing directory that houses the internal data structure required for version control.

A

git init

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Creates a local copy of a project that already exists remotely. The clone includes all the project’s files, history, and branches.

A

git clone

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Stages a change. Git tracks changes to a developer’s codebase, but it’s necessary to stage and take a snapshot of the changes to include them in the project’s history. This command performs staging, the first part of that two-step process. Any changes that are staged will become a part of the next snapshot and a part of the project’s history. Staging and committing separately gives developers complete control over the history of their project without changing how they code and work.

A

git add

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Saves the snapshot to the project history and completes the change-tracking process. In short, a commit functions like taking a photo. Anything that’s been staged with git add will become a part of the snapshot with git commit.

A

git commit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Shows the status of changes as untracked, modified, or staged.

A

git status

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Shows the branches being worked on locally.

A

git branch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Merges lines of development together. This command is typically used to combine changes made on two distinct branches. For example, a developer would merge when they want to combine changes from a feature branch into the main branch for deployment.

A

git merge

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Updates the local line of development with updates from its remote counterpart. Developers use this command if a teammate has made commits to a branch on a remote, and they would like to reflect those changes in their local environment.

A

git pull

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Updates the remote repository with any commits made locally to a branch.

A

git push

How well did you know this?
1
Not at all
2
3
4
5
Perfectly