Version control with Git Shuai Wei IST Research

  • Slides: 52
Download presentation
Version control with Git Shuai Wei IS&T Research Computing Services Boston University

Version control with Git Shuai Wei IS&T Research Computing Services Boston University

Git: main features ü Track all your changes ü Work along with others ü

Git: main features ü Track all your changes ü Work along with others ü Share work with others With Git

Git Workflow Local computer Github. com

Git Workflow Local computer Github. com

Github. com • A web-server that allows you to save/access your repository remotely. •

Github. com • A web-server that allows you to save/access your repository remotely. • Easy to share with collaborators.

Git Terminology Repository-container for snapshots and history Remote-connection to another repository for example Git.

Git Terminology Repository-container for snapshots and history Remote-connection to another repository for example Git. Hub (like URL) Commit. A snapshot, basic unit of history Full copy of a project Includes author, time, comments, pointer to the parent Reference-a pointer to commit Branch -a separate line of workflow Merge-a commit that combines 2 lines of history (points to 2 parents)

Installing Git

Installing Git

Login to the SCC Username: tuta# Password: Viz. Tut# #-is the number located on

Login to the SCC Username: tuta# Password: Viz. Tut# #-is the number located on your computer Note: • Username and password are case-sensitive • password will not be displayed while you are typing it

Git: basic configuration # select the latest version of git # check gitversion

Git: basic configuration # select the latest version of git # check gitversion

Git basic configuration Command Interpreter program Flag Key Value Notes: • Vim is the

Git basic configuration Command Interpreter program Flag Key Value Notes: • Vim is the default editor used by git • Select gedit if you are not familiar with vim or emacs editors

Git basic configuration

Git basic configuration

Git advanced configuration

Git advanced configuration

Git create a repository (from nothing) # create a project with a name mypro

Git create a repository (from nothing) # create a project with a name mypro # change directory (go inside project directory) # list files in the directory

Git status

Git status

Git check the status

Git check the status

Create a new file • Using your favorite editor, open a file hello. py

Create a new file • Using your favorite editor, open a file hello. py and enter the following content: Save the file with the name hello. py and exit. Note: if you are not familiar with vim or emacs editors, used gedit to edit files: gedithello. py

Execute the python script (optional)

Execute the python script (optional)

Git check the status again

Git check the status again

Git add the file to the repository

Git add the file to the repository

Git commit Note: Make sure to enter clear, concise and meaningful comments about your

Git commit Note: Make sure to enter clear, concise and meaningful comments about your commits!

Modify a file that is tracked by git • Use your favorite editor to

Modify a file that is tracked by git • Use your favorite editor to edit hello. py file. • Save and exit it.

Create a new README file • Create and edit your file of name README.

Create a new README file • Create and edit your file of name README. • Save and exit it.

Check the status

Check the status

Add both files on staging area Note: Files can be added one by one

Add both files on staging area Note: Files can be added one by one or listed together

Git commit Write your commit message here and save/exit this file • Save and

Git commit Write your commit message here and save/exit this file • Save and exit it.

Git commit

Git commit

Git: view the history of commits

Git: view the history of commits

Modify a hello. py file again • Edit your hello. py file like this:

Modify a hello. py file again • Edit your hello. py file like this: • Save and exit it.

A full checking/adding/committing process

A full checking/adding/committing process

Git: view log with a graph

Git: view log with a graph

Git: one line log

Git: one line log

Git: graphical tool

Git: graphical tool

Git: reviewing previous commits

Git: reviewing previous commits

Git: returning to the last commit

Git: returning to the last commit

Git: hard delete of the latest commits

Git: hard delete of the latest commits

Renaming a file (Git way)

Renaming a file (Git way)

Git ingore

Git ingore

Github. com • A web-server that allows you to save/access your repository remotely. •

Github. com • A web-server that allows you to save/access your repository remotely. • Easy to share with collaborators.

Git. Hub desktop • It’s a fast, easy way to contribute to projects from

Git. Hub desktop • It’s a fast, easy way to contribute to projects from OS X and Windows. • Git. Hub workflow and replace Git. Hub for Mac and Windows with a unified experience across both platforms.

Setting up Git. Hub Desktop • Installing Git. Hub Desktop • https: //desktop. github.

Setting up Git. Hub Desktop • Installing Git. Hub Desktop • https: //desktop. github. com/ • Authenticating to Git. Hub • Add your Git. Hub. com account information to Git. Hub Desktop • Configuring Git for Git. Hub Desktop • If you don’t have Git installed, you must configure it before using Git. Hub Desktop.

Authenticating to Git. Hub or

Authenticating to Git. Hub or

Creating Git. Hub account if you don’t have an account already

Creating Git. Hub account if you don’t have an account already

Configuring Git. Hub account

Configuring Git. Hub account

Configuring Git. Hub account

Configuring Git. Hub account

Configuring Git. Hub account

Configuring Git. Hub account

New repository

New repository

New repository

New repository

Since we have an existing repository on local:

Since we have an existing repository on local:

Push the local repository to Github. com

Push the local repository to Github. com

Download/ Git clone

Download/ Git clone

Git clone <remote_address>

Git clone <remote_address>

Other resources to learn Git: • https: //help. github. com/desktop/ • http: //try. github.

Other resources to learn Git: • https: //help. github. com/desktop/ • http: //try. github. io/ • https: //www. atlassian. com/git/tutorials • git help

Thank you for attending the tutorial! Please fill the evaluation form: http: //scv. bu.

Thank you for attending the tutorial! Please fill the evaluation form: http: //scv. bu. edu/survey/tutorial_evaluation. html Questions: help@scc. bu. edu 52