GIT Chapter 1 Flashcards

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

What is a ‘Local Repository’ ?

A

Files which are stored on your laptop in Git is called Local Repository.Modifications done here in files - Git will maintain history of changes

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

what is the purpose of the command ‘CLONE’ ?

A

Used to checkout code from remote repository

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

what is a ‘Remote Repository’ ?

A

The repository on server is called ‘Remote Repository’

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

How do we copy or checkout code from server ?

A

We can ‘checkout’ code from server ( remote reposiotry ) using the CLONE command.

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

What are ‘HEADS’ ?

A

This is just a term - by which Git maintains commit history for each branch.

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

How do we see different ‘BRANCHES’ ?

A

Use the command:

‘git branch’

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

what are ‘TAGS’ ?

A

This is a useful feature - which allows us to create a SNAPSHOT of code ‘at that point in time’.
This feature is typically used to maintain production released code - so that if ever we cant to go back to a specific version - using this feature we can.

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

How do I see the different tags in my code ?

A

Use the command:

tag -l

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

How do I create a new branch from an existing tag ?

A

Typically on first cloning from remote repository we will be in ‘master’.
Now to create a branch - xyz from a specific tag - tag123 - use the command:
git checkout -b xyz tag123
This will create a new branch - xyz
Unlike svn - you will not see any folder for new branch.

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

How does a ‘BRANCH’ in Git differ from SVN ?

A

There is no folder for a branch.
Only thing is in gitbash - it would show which branch you are working on
when you list all the branches - the branch that you are currently in - will be shown with an *

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

what is the advantage and use of GIT ?

A

It is distributed ( DVCS ) - so everyone has the completes repository on their desktop.
Commits can be made locally - ‘offline’

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

How do I create a ‘Repo’

A

Use the command :
git init
This will create a local repo.
This is the starting point

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

what do we mean by ‘UNTRACKED’ ?

A

Files that are not under GIT control are ‘Untracked’

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

what does the command ‘git status’ do ?

A

It is used to tell us what has changed since last commit.

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

How do I find changes since my last commit ?

A

Use the command :

git status

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

How do I see commit history ?

A

Use the command:

git status

17
Q

what is the typical workflow in GIT ?

A

One flow is :
Add a file as ‘untracked’
Add file to ‘staging area’
Commit

OR
Modify existing file
Add changed file to ‘staging area’
Commit

18
Q

Explain the ‘untracked’ details in workflow

A

Lets say you are in a repository.
You create a new file .
Now when you run ‘git status’ - it tells us that we have untracked file present.

19
Q

How do I start ‘tracking’ an ‘untracked’ file ?

A

To start tracking - simply use the command:
git add
This will change the file from ‘untracked’ to ‘tracked’
The file is now in staging area.
Running the command - git status :
tells us that file is staged and needs to be committed …

20
Q

How do I commit untracked files ?

A

To commit ‘tracked’ files use the command:
git commit -m ‘’

So this completes the workflow step 3 - commiting files in staging

21
Q

what is ‘MASTER’

A

xxxx

22
Q

Can I directly commit ‘untracked’ files ?

A

No - Git will ignore the attempt to commit untracked files.

So first the files must be placed in staging area and only then will git commit work.

23
Q

How do I find files that have been modified but not committed ?

A

Using the command : git status

This tells us the names of the files that have been modified.

24
Q

How do I undo changes to modified files - essentially revert my changes in GIT ?

A

Use the command:
git checkout –
This will essentially revert your changes made in file.

25
Q

How do I undo changes made to modified files - using TortoiseGit ?

A

The changed files will appear with a red icon.
Simply right click on the file and choose :
‘revert’
Now you can choose the modified files you would like to revert thats it !

26
Q

Can I modify a file which is already under git and then commit it directly….. without putting it in staging area ?

A

No - even if you make changes in a file and fire the command for commit - git will ignore the commit.
Git will infact tell us following message:
‘Changes not staged for commit:’

27
Q

How do I add all the files that I have added or modified to a staging area ?

A

Use the command:

git add –all

28
Q

what does the following command do:

git add –all

A

This command will move all untracked files and also all modified files into staging area - thus making them eligible for committing.

29
Q

what does the following command do:

git log

A

This command will provide commit history details

30
Q

How do I see the commit history details ?

A

Use the command:

git log