Документация по Git и GitHub

Урок 1. Введение в git и GitHub

git?
    git is a version control software
    It keep track of code changes
    It helps to collaborate in a project
    It is installed and maintained locally
    It provides Command Line Interface (CLI)
    Released in April 7, 2005
    Developed by Linus Torvalds & Junio C Hamano
github?
    GitHub is a hosting service where we can keep our git    repositiory/folders
    It is maintained on cloud/web
    It provides Graphical User Interface (GUI)
    Founded in 2008
Вход в полноэкранный режим Выход из полноэкранного режима

Урок 2. Как настроить среду и конфигурацию git

Download and install git on your pc: https://git-scm.com/
check git version: open terminal or cmd then use the command git --version to find out whether git is installed or not. if git is installed it will return a version number of git.
Вход в полноэкранный режим Выход из полноэкранного режима

конфигурация git

check all configuartion options: git config
set global user name and user email for all repository/git folders (if you want to set different username and email for different git repository then remove --global)
    set global user name: git config --global user.name "anisul-islam"
    set global user email: git config --global user.email "anisul2010s@yahoo.co.uk"
list all git configuration:
    list all the configuration: git config --list
    list user name: git config user.name
    list user email: git config user.email
change global username & email
    change global user name: git config --global user.name "PUT_NEW_USER_NAME_HERE"
    change global user email: git config --global user.email "PUT_NEW_USER_EMAIL_HERE"
Войти в полноэкранный режим Выход из полноэкранного режима

Урок 3. создание git-репо и добавление новых файлов

creating a git folder

ls -a : list all files inside of a directory
Вход в полноэкранный режим Выход из полноэкранного режима
 `mkdir DIRECTORY_NAME_HERE
    cd DIRECTORY_NAME_HERE
    git init

    Example:
    mkdir notes
    cd notes
    git init
    ls -a
Войти в полноэкранный режим Выход из полноэкранного режима

`
добавление новых файлов в папку git

git status : displays the state of the working directory and staging area
Войти в полноэкранный режим Выход из полноэкранного режима

`
ls -a
touch fileName.extension
открыть файл fileName.extension
статус git

Example:
touch day1.txt
open day1.txt
write something inside the file
Вход в полноэкранный режим Выйти из полноэкранного режима

`

Git is aware of the file but not added to our git repo

Files in git repo can have 2 states – tracked (git knows and added to git repo), untracked (file in the working directory, but not added to the local repository)

To make the file trackable stagging or adding is required
Войти в полноэкранный режим Выйти из полноэкранного режима

Урок 4. как добавлять файлы в staging area & удалять файлы

adding files to stagging area:

git add fileName add a file in staging area / index
git add . add all files of directory to stagging area not subdirectory
git add -A add all files of directory and subdirectory to stagging area
Вход в полноэкранный режим Exit fullscreen mode

`
git rm —cached fileName unstage a file from staging area
git diff — checking the differences of a staged file
git restore fileName — restore the file

`

Lesson 5. practice-1

Lesson 6. commit & uncommit

git commit -m "message" move the file to local repository from stagging area
git log check the commit history
git reset --soft HEAD^ uncommit the commit in HEAD and move to staging area
git reset HEAD^ uncommit the commit in HEAD and move to unstaging / working area
git reset --hard HEAD^ uncommit the commit in HEAD and delete the commit completely with all the changes
Enter fullscreen mode Exit fullscreen mode

Lesson 7. git HEAD and undo theory


git log --oneline
git show
git show HEAD^
git show commit-id
git checkout commit-id
git checkout master

Lesson 8. git HEAD and undo practical

Lesson 9. git revert

Lesson 10. git ignore

create a .gitignore file and add the things you do not want to add in the stagging area
Inside .gitignore we can keep secret files, hidden files, temporary files, log files
secret.txt secret.txt will be ignored
*.txt ignore all files with .txt extension
!main.txt ignore all files with .txt extension without .main.txt
test?.txt ignore all files like test1.txt test2.txt
temp/ all the files in temp folders will be ignored
Enter fullscreen mode Exit fullscreen mode

Lesson 11. how to create github repository and commits


sign in to your github account
create a git repo

Lesson 12. README.md

Everything you need to know about README.md is discussed in the video.
6 heading levels: number of hashes define heading levels. check the following examples:
    # heading 1 level text is here
    ## heading 2 level text is here
bold syntax: __text goes here__
italic syntax: _text goes here_
italic syntax: _text goes here_
strikethrouh syntax: ~this is~~
single line code syntax: `` place code inside backticks
multiple line code syntax: ``` place code inside three open and closing backticks
multiple line code syntax: ```html for specific lanaguage use language name when starting; not closing
for more please check the video by clicking the link given above
Enter fullscreen mode Exit fullscreen mode

Lesson 13. Connecting local repo to remote repo

check remote connection: git remote or git remote -v
git remote add name <REMOTE_URL> example: git remote add origin http://...
Enter fullscreen mode Exit fullscreen mode

Lesson 14. push and pull


push a branch git push -u origin branch_name
push all branches git push --all
pull from a repo: git pull which is equivalent to git fetch + git merge

Lesson 15. branching and merging

Branch is a new and separate branch of master/main repository
create a branch git branch branch_name
List branches git branch
List all remote branches git branch -r
List all local & remote branches git branch -a
move to a branch git checkout branch_name
create and move to a branch git checkout -b branch_name
delete a branch: git branch -d branch_name
merge branches:
Enter fullscreen mode Exit fullscreen mode

`
git checkout branchName
git merge branchName

git log --oneline --all --graph
Enter fullscreen mode Exit fullscreen mode

`

Lesson 18. branching and merging locally

Lesson 19. git and GitHub practice — 2

Lesson 20. GitHub Issues

Lesson 21. 2-way and 3-way merges

Reeference:
Вход в полноэкранный режим Выход из полноэкранного режима


https://www.tutorialspoint.com/what-is-a-fast-forward-merge-in-git
https://www.tutorialspoint.com/what-is-3-way-merge-or-merge-commit-in-git
https://medium.com/@koteswar.meesala/git-fast-forward-merge-vs-three-way-merge-8591434dd350

Lesson 22. Merge Conflicts


https://www.tutorialspoint.com/what-is-merge-conflict-in-git-how-to-handle-merge-conflicts

`

`

Оставьте комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *