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"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值