intermediate git Flashcards

(11 cards)

1
Q

how to list brnaches? create new one?

A

1- git branch -> list all branches
2- git branch branch_name -> create new branch
3- git switch branch_name -> switch to the branch
4- git switch -c branch_name -> creat and switch to the created branchs

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

how to comapre between branches? rename branch? and delete branch?

A

1- git diff branch_1 branch__2 -> show the diff between branchs
2- git branch -m old_name new_name -> rename the branch to the new branch
3- git branch -d branch_name -> delete the branch after merging
4- git branch -D branch_name -> delet the branch without merging it

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

how to merge branches?

A

method one: switch to the destination (main for example) and use: git merge source_branch
- method 2 : use git merge sourcce_branch destination_destination

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

how to handle coflict file?

A

1- open the file and remove the arros and eqaul sign in shell
2- ctr+o , enter to save then ctrl+x to exit
3- git add the file again, git commit then git merge

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

how to deal a copy from local or published repos?

A

1- git clone path -> copy the repo in local
2- git clone URL -> copy the repo from the internet
3- git clone URL_or_path new_name -> copy repos and assign new name for it
4- git remote -> list all remote repos that are cloned
5- git remote -v -> do the same with more details
6- git remote add name URL -> assign the a name for the url instead of deafault name that is in tag in the configuration ( default name=origin)

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

how to fetch remote ?

A

1- git fetch repo_name -> to download the repo name without merging it.
2- git pull repo_name -> to download the repo with mergeing it

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

how to update remote branches?

A

git push remote_branch_or_repo local_repo_or_branch

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

what is the differnces between git and github?

A

git is a version control software aim to track changes in files, while github is a cloud based hosting service/platform built on top of git

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