• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/21

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

21 Cards in this Set

  • Front
  • Back

What does mean "staged file"?

The file which can be committed (added and modified)

If you git add directory, will files in this directory be added?

Yes, all files will be added recursively from this directory

Purposes of 'add'

1. begin trackingnew files


2. stage files


3. marking merge-conflictedfiles as resolved

What will you see as a result of 'git status' after modification of staged file?

The previous version of file will be kept in staging area, new version will be in working directory. You need 'add' modified file explicitly to update it in staging area

How to print short status? What do mean signs of such files: '??', A, M? What is meaning of two columns for these symbols?

git status -s


?? - new files that aren't tracked


A - new files that have been added to staging area


M - modified files.




There are two columns to the output - the le -hand column indicates the statusof the staging area and the right-hand column indicates the status of the working tree.




So:




AM - just added to staging, after that modified in working area


MM - previously committed file is modified and added to staging area, after that this file is modified in working area

git ignore: how to set git to ignore all file which ends with .o or .a?

*.[oa]

git ignore: how to make an exclusion for 'my.out' if all .out file are ignored?

!my.out

git ignore: how to ignore only the TODO file in the current directory, not subdir/TODO

/TODO

git ignore: hot to ignore all files in the build/ directory

build/

git ignore: how to ignore doc/notes.txt, but not doc/server/arch.txt

doc/*.txt

Will the pattern work for all directory recursively by default?

yes

What does mean slash on pattern start?

You can start patterns with a forward slash (/) to avoid recursively.




# only ignore the TODO file in the current directory, not subdir/TODO:




/TODO

What does mean slash on pattern end?

You can end patterns with a forward slash (/) to specify a directory.




# ignore all files in the build/ directory:




build/

How to undo not committed file modifying?

git checkout --

How to remove file from staging area?

git reset HEAD

How to commit all modified files skipped of their staging?

git commit -a -m "comment"

rm VS git rm VS git rm --cached

1. rm just removes file from working directory. After that you need to add this standing area before commit, otherwise in git repo won't be committed any changes




2. git rm removes file from working directory and add this change to staging area at once




3.git rm --cached used when file which should be removed from repo is already staged

git push --force-with-lease

проверяет, чтобы ваша локальная копия ref’а была самой свежей, прежде чем накатить её. Это означает, что вы как минимум подтянули все изменения, которые собираетесь затоптать на удаленном репозитории.

Почему рекомендуется первый коммит делать пустым?

Первому коммиту в репозитории нельзя сделать ребейз, как обычному. Поэтому рекомендуется в качестве корневого создавать пустой коммит.




Однако, вроде все же можно использовать git rebase -i --root

Как закоммитить пустой коммит?

git commit -m “my empty commit” --allow-empty

git merge vs merge --no-ff

Если не добавить к merge команде опции, то по умолчанию станет использоваться стратегия слияния --ff, при которой новый коммит слияния будет создан только в том случае, если в мастер-ветке нет новых изменений.




В противном случае мастер-ветка просто «перемотается» до места последнего коммита в вашей ветке. Тогда сложнее определеить какой код был разработан в какой ветке.




--no-ff - стратегия при которой всегда создаётся коммит слияния.