GIT Flashcards

1
Q

To “squash”

A

The act of “squashing” your commits means that you combine multiple existing commits into a single one. If you should do this or avoid it is - to some extent - a question of preference: in some teams, for example, squashing commits is the preferred way to merge a feature branch back into a long-running branch like “master” or “main”.

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

Order of steps?

A

Branch????
1. Add
2.Commit
3.pull( FETCH+MERGE)!!!!!!!!!!!!!!!!!!!!!!!!!
4. Push?

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

Git

A

Git is an open-source version control system often used for source code management

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

How to integrate changes from one branch onto another in GIT

A

1.Rebasing - the linear process of merging
Rebasing is the process of combining or moving a sequence of commits on top of a new base commit.

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

Git commands

A

1.CLONE
git clone URL
Git clone is a command for downloading existing source code from a remote repository (like Github, for example). In other words, Git clone basically makes an identical copy of the latest version of a project in a repository and saves it to your computer.

2.BRANCH
-By using branches, several developers are able to work in parallel on the same project simultaneously

2.1. Creating a new branch locally
git branch <branch-name></branch-name>

2.2.Switching from one branch to another
git checkout <name-of-your-branch></name-of-your-branch>

*The changes in your current branch must be committed or stashed before you switch
*The branch you want to check out should exist in your local
*create and switch to a branch at the same time:
git checkout -b <name-of-your-branch></name-of-your-branch>

2.3. Push the new branch into the remote repository
git push -u <remote> <branch-name>
2.3. Viewing branches:
git branch or git branch --list</branch-name></remote>

2.4. Deleting a branch:
git branch -d <branch-name></branch-name>

  1. GIT STATUS
  2. ADD–> add the files to the staging area
    git add file
    git add -A (all)
  3. COMMIT
    Git commit is like setting a checkpoint in the development process which you can go back to later if needed.

git commit -m “commit message”
Git commit saves your changes only locally.!!!!!

  1. PUSH
    Git push uploads your commits to the remote repository.
    git push <remote> <branch-name>
    However, if your branch is newly created, then you also need to upload the branch with the following command:
    Statuls of the file: Staged, unstaged, untracked</branch-name></remote>
  2. PULL
    git pull <remote>
    used to get updates from the remote repo. This command is a combination of git fetch and git merge which means that, when we use git pull, it gets the updates from remote repository (git fetch) and immediately applies the latest changes in your local (git merge).</remote>
  3. REVERT
    first we need to use git log – oneline:
    Then we just need to specify the hash code next to our commit that we would like to undo:

git revert 3321844

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