intermediate git Flashcards
(11 cards)
how to list brnaches? create new one?
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 to comapre between branches? rename branch? and delete branch?
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 to merge branches?
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 to handle coflict file?
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 to deal a copy from local or published repos?
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 to fetch remote ?
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 to update remote branches?
git push remote_branch_or_repo local_repo_or_branch
what is the differnces between git and github?
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