Version Control with Git (Udacity)优达学城笔记--L1:What is Version Control

简介:

What is Version Control

version control: control version

Version Cotrol Systems: Git, Subversion, Mercurial

  • Centralized:all users connect to a central, master repository
  • Distributed: each user has the entire repository on their computer

git: Distributed version control system

  • git: Version control tool
  • GitHub: Service that hosts Git projects

version control system(VCS) is a tool that manages different versions of source code.

source code manager(SCM) is another name for a version control system.

Git

commit save the state of your project in Git

repository(repo) is a directory which contains your project work, as well as a few files which are used to communicate with Git.Repositories can exit either locally on your computer or as remote copy on another computer. A repository is made up of commits.

working directory is the files that you see in your computer's file system. When you open your project files up on a code editor, you're working with files in the Working Directory. This is in contrast to the files that have been saved(in commits!) in the repository. When working with Git, the Working Directory is also different from the command line's concept of the current working directory which is the directory that your shell is "looking at" right now.

Checkout is when content in the repository has been copied to the Working Directory.

Staging Area/Staging Index/Index A file in the Git directory that stores information about what will go into your next commit.

SHA is basically an ID number for each commit. It is a 40-character string composed of characters(0-9 and a-f) and calculated based on the contents of a file or directory structure in Git. Secure Hash Algorithm.

Branch is when a new line of development is created that diverges from the main line of development.

Installing Git https://git-scm.com/downloads

git

usage:git [--version] [--help] [-C ] [-c name=value] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-pl--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [--namespace=] []

The most commonly used git commands are:

  • Add Add file contents to the index
  • bisect Find by binary search the change that introduced a bug
  • branch List,create,or delete branches
  • checkout Checkout a branch or paths to the working tree
  • clone Clone a repository into a new directory
  • commint Record changes to the repository
  • diff Show changes to the repository
  • fetch Download objects and refs from another repository
  • grep Print lines matching a pattern
  • init Create an empty Git repository or reinitialize an existing one
  • log Show commit logs
  • merge Join two or more development histories together
  • mv Move or rename a file, a directory, or a symlink
  • pull Fetch from and integrate with another repository or a local branch
  • push Update remote refs along with associated objects
  • rebase Forward-port local commits to the updated upstream head
  • reset Reset current HEAD to the specified state
  • rm Remove files from the working tree and from the index
  • show Show various types of objects
  • status Show the working tree status
  • tag Create, list, delete or verify a tag object signed with GPG

'git help -a' and 'git help -g' lists available subcommands and some concept guides. See 'git help ' or 'git help ' to read about a specific subcommand or concept.

Configuration Steps

cd
start .
mv udacity-terminal-config .udacity-terminal-config

First Time Git Configuration

git config --global user.name "<Your-Full-Name>"        #sets up Git with your name

git config --global user.email "<your-email-address>"    #sets up Git with your email

git config --global color.ui auto    #makes sure taht Git output is colored

git config --global merge.conflictstyle diff3    #displays the original state in a conflict

git config --list

associate X text editor with Git

Atom Editor Setup

git config --global core.editor "atom --wait"

Sublime Text Setup

git config --global core.editor "'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl' -n -w"

VSCode Setup

git config --global core.editor "code -wait"
相关文章
|
Shell 开发工具 git
Git笔记(三)---- Git分支操作
Git笔记(三)---- Git分支操作
132 0
|
Shell 开发工具 git
[笔记]Git 介绍以及入门基本功能(一)
[笔记]Git 介绍以及入门基本功能
|
7月前
|
存储 XML Shell
Git笔记
Git笔记
48 0
|
7月前
|
开发工具 git
git使用笔记-修改url并与远端库合并
git使用笔记-修改url并与远端库合并
44 1
|
7月前
|
Shell 开发工具 数据安全/隐私保护
git笔记
git笔记
70 0
|
Shell 网络安全 开发工具
git理解之超薄笔记
git理解之超薄笔记
84 1
git理解之超薄笔记
|
Shell 开发工具 git
[笔记]Git 介绍以及入门基本功能(二)
[笔记]Git 介绍以及入门基本功能(二)
|
Shell 网络安全 开发工具
git版本管理加合并笔记
git版本管理加合并笔记
|
开发工具 git
常见git操作笔记
常见git操作笔记
81 1
|
安全 程序员 开发工具
代码版本管理笔记 | Python 程序员也应该会的 Git 分支操作
代码版本管理笔记 | Python 程序员也应该会的 Git 分支操作
194 0