GIT-Karteikarten | Quizlet

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/23

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

24 Terms

1
New cards

What command is used to initiate, copy and create a shared Git repository? What is used

git init

- Only needs to be created once to create a central repository- can turn a project folder into a git repository

- git clone can be used to copy the repository to a local machine

- --bare - used when a git repository is to be shared

2
New cards

What is the syntax of the command for the clone command?

git clone

- repo - is the location of the repository to clone

- directory - is the location on the local machine

3
New cards

How do you know that a repository is a non-bare repository?

- The --bare flag creates a repository that doesn't have a working directory - making it impossible to edit files and commit changes

- you can tell that the repository is bare because the .git extension is omitted from the cloned repository - meaning no .git folder, it is an ordinary project folder

- the developer cloned versions of the bare repository are Non-bare, so development can take place in this repository

4
New cards

What are the scopes permissions in GIT and what are the working files that contain this information?

- local (will override user and global settings) - /.git/config

- user (will override global settings) - ~/.gitconfig

- global - $(previs)/etc/gitconfig

5
New cards

How do you configure the current repository with user information?

- git config --global user.name (the global is used to set the configuration options for the current user)

- git config --global user.email

6
New cards

What are some configuration details for the repository?

- git config - global alias.

- git config --system core.editor

7
New cards

What are the commands for adding a file and their characteristics?

- git add - file with changes for the next commit

- git add - stage all changes in a directory for next commit

- git add -p - interactive session where portions of the file can be added to the next commit

The next steps is to perform a commit

- git add hello.py

- git commit

8
New cards

What are the commands for a Git commit

- git commit - commits and launches the text editor to create a message

- git commit -m " - message can be entered at the time of the commit

- git commit -a - this commits a snapshot of all changes in the working directory. includes modifications to tracked files.

9
New cards

What are the differences between git and SVN

- SVN uses differences and git uses snap shots of entire files

- SVN has the central working copy in the central repository

- Git makes it easier to split up a feature into atomic commits

- Git allows cleaning up of changes before a commit takes place

- Git permits developers to work in an isolated environment

10
New cards

What is the difference between git status and git log?

Git status displays the state of the working directory and the staging area.

- which changes have been staged

- which files are not being tracked

Git log - displays the committed project history

11
New cards

How do you set a file to be ignored by Git?

there is a special file named .gitignore which lets you include files to be ignored

12
New cards

What are the commands provided with git log?

- git log - displays entire commit history

- git log -n - displays the specified number of commits

- git log --oneline - condenses each log entry to one line

- git log -p - detailed view showing the detailed view of each commit

- git log --author="" - commit messages by author that matches the pattern - plain string or regular expression

- git log --grep="" - commit messages by author that matches the pattern - plain string or regular expression

- git log ... - arguments can be either a commit ID, branch name, HEAD or any other kind of reference

- git log - commits that include the specified file

- git log --graph --decoreate -oneline -

- graph - draws a graphon the left hand side of the commit message

- decoreate - adds the names of the branches or tags of the commits

- online - shows the commit information in a single line

13
New cards

What is the syntax to checkout a file from Git?

git checkout master - returns the "master" branch (current state of project)

- git checkout - turns the file residing in the working directory int an exact copy of the one from the - adds to staging area

- git checkout - update all files to match the specified commit

14
New cards

What does the "revert" command do

- used when you want to remove an entire commit from your project history

- it undoes a single commit by adding a new commit to undo the changes

- undoes a committed snapshot

- unlike 'reset' keeps track of project history

- undoes the changes introduced by the commit

- appends a new commit with the resulting content

- keeps track of these changes in history

- git revert

15
New cards

What does the --hard flag do for the reset command?

The --hard flag will overwrite the working directory with changes so that all traces of the previous work will be overwritten

16
New cards

Where is it common to use 'reset' and 'revert'

'reset' is typically used for local repositories, 'revert' is commonly used for public repositories

- 'reset' should never be used on public repositories because it can mess up others who are collaborating and when they try to sync their repositories

17
New cards

What is git clean used for and what are the popular flags

- git clean is used to remove untracked files from the working directory.

- not undoable - similar to the rm command

- often executed with git reset --hard

- git clean -n - show files to be removed without removing them

- git clean -f -removes from the current directory

- git clear -df removes directories as well as files

18
New cards

What is the purpose and syntax of a git branch

- git branch represents an independent line of development

- think of it as a brand new working directory

- new commits recorded in the history of the new branch

- will result in a fork in the history of the project

Command Syntax

- git branch - list of all branches in the repository

- git branch - creates a new branch

- git branch -d - deletes a branch.... -D to delete a branch with unmerged changes

- git branch -m -rename current branch

19
New cards

What are the two types of merge commands and what is the difference between the two?

- Fast forward and 3-way merge

- Fast forward - the master has not changed since the branch was created so the branch is merged into the master

- 3 way merge - the master has a committed change since the branch was created. So the two must be merged. if the same file was changed in both the branch and the master, conflict resolution is required

Command Syntax

- git merge - merges specified branch into current branch and determines that merge algorithm automatically

- git merge --no-ff - merges specified branch into current branch and generate a merge commit

20
New cards

How do you resolve a conflict in a 3-way merge?

- git status - shows the file(s) with a conflict

- fix the conflicting file

- git commit

21
New cards

What is the purpose of the git checkout and what is the syntax?

- The git checkout lets you navigate between the branches created by git branch

- similar to having the branch updated to match the selected branch/revision

Command Syntax

- git checkout - makes the current branch and updates the working directory

- git checkout -b - - runs git branch before running git checkout

- git checkout -b - base new branch off the instead of the current branch

22
New cards

What is being referred to by the 'HEAD' or 'detached HEAD'

HEAD - git is referring to the current snapshot

detached HEAD - when pointing to a branch. Git refers to this a detached HEAD because there would be no branch allowing you to get back to it.

23
New cards

Provide examples of the tasks that you can do from checking out master?

- merge in completed features from a different branch

- create a new branch

- work on the current master branch

24
New cards

What is the purpose of these four commands

- git remote

- git fetch

- git pull

- git push

git remote - method of managing remote connections

- git remote -v - list connections with the URLs

- add, rm, rename - add, remove, and rename a connection

git fetch - imports commits and stores them in remote branches - files can be reviewed before importing into the project

git pull - merging upstream changes into your local repository (combination of 'git fetch' and 'git merge')

git push - transfers commits from local to remote repositories