怎么用dw做响应式网站,怎样做类似淘宝网的网站,怎么做万网网站,网页模板免费下载文章目录 1. GIT介绍2. 使用GIT的好处3. GIT 安装4. GIT 配置4.1 GIT 初始化设置、命令别名设置4.2 如果终端安装了oh-my-zsh#xff0c;会带一堆git命令别名4.3 GIT配置文件介绍4.3.1 Linux、Mac OS系统4.3.2 windows系统 5. git设置远程仓库账号密码(拉取、上传代码不用输入… 文章目录 1. GIT介绍2. 使用GIT的好处3. GIT 安装4. GIT 配置4.1 GIT 初始化设置、命令别名设置4.2 如果终端安装了oh-my-zsh会带一堆git命令别名4.3 GIT配置文件介绍4.3.1 Linux、Mac OS系统4.3.2 windows系统 5. git设置远程仓库账号密码(拉取、上传代码不用输入用户名密码)6. git文件夹详解7. 图形软件操作工具 1. GIT介绍
git是一个分布式版本控制软件与常用的版本控制工具如CVS、Subversion不同支持离线开发离线存储。强大的分支功能适合多个独立开发者协作。速度块。 用户从远端GIT仓库下载一个工程(project)时这个工程的所有文件包括版本历史文件改动都会下载下来这时 候本地GIT就演变成了一个服务器所有的提交(check-in)、提出(check-out)都会在这个本地服务器上执行当你确定一项修改之后可 以再和远端仓库进行合并和同步(merge)。所以GIT的安装和配置步骤无论在本机还是服务器上都是完全一样的。
2. 使用GIT的好处
更顺畅的工作流程开发过程中完全可以离线操作快速Git分布式架构使得本地仓库包含所有的历史版本信息你可以在不同的版之间快速切换弹性的本地分支在svn下你建一个分支需要把源代码复制到另外一个文件夹而在Git下创建分支的代价是非常小的只需一条命令仓库目录结构简洁用Git复制一个项目只会在项目根目录创建一个.git的目录而其他目录很干净内容按原数据方式存储所有的版本信息都位于.git目录下完整性好更易于协作开发用户群大现在已经有成千上万个开源项目采用Git来做项目管理github上更是有无数个代码仓库
参考链接 http://blog.csdn.net/fyx708711/article/details/52606252
3. GIT 安装
https://git-scm.com/book/zh/v2/起步-安装-Git
1、 linux系统的centos7.2安装
sudo yum update
sudo yum install -y git2、ubuntu 安装(一般系统默认就安装了)
# http://www.linuxidc.com/Linux/2016-09/135527.htm
sudo apt-get install git3、Mac OS苹果系统(一般默认就安装了需要事先安装了homebrew )
brew install git4、windows系统安装git终端
https://git-for-windows.github.io/
安装教程https://jingyan.baidu.com/article/20095761b48041cb0721b4fc.html
4. GIT 配置
linux、mac系统打开终端进行下面配置。
window系统打开git bash终进行下面端配置。
4.1 GIT 初始化设置、命令别名设置
下面操作linux, Mac OS, window 都适用。
设置用户名和邮箱
# https://git-scm.com/book/zh/v2/起步-初次运行-Git-前的配置
# https://git-scm.com/book/zh/v2/自定义-Git-配置-Git
git config --global user.name name # 设置GIT的用户名
git config --global user.email you_email_addrgmail.com # 设置GIT的邮箱必须要的配置
git config --global core.mergeoptions --no-edit # 关闭git pull产生的merge信息
git config --global commit.template ~/.gitmessage.txt # git 提交时编辑里面的模板
# 终端内容显示颜色false关闭 auto自动有的颜色会忽略 always忽略掉管道和终端的不同即在任何情况下着色输出
git config --global color.ui false# 使用VIM编辑器编辑作为GIT的默认编辑器
git config --global core.editor vim
# 存储credential(凭证)自动保存远程仓库账号密码
git config --global credential.helper store
# https://git-scm.com/book/zh/v2/Git-工具-凭证存储
# 关闭对0x80以上的字符进行quote 解决git的中文乱码问题。
git config --global core.quotepath false
# 自动转换LF和CRLF(不同操作系统换行不同问题)。
git config --global core.autocrlf true
# 把CRLF自动转换警告取消
git config --global core.safecrlf false
# 设置git识别大小写
git config core.ignorecase false
# 修改git log中时间的显示格式为 2021-07-14 10:13:17 0800
git config --global log.date iso8601
git config --global --replace-all log.date format:%Y-%m-%d %H:%M:%S# 查看上面的配置
git config --list
# 查看git路径
which git
# 删除一个配置项
git config --global --unset log.date
# 编辑配置文件
git config --global --editGIT命令别名 方便操作快捷(频繁git操作的时候命令简化。):
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.hist log --prettyformat:%h %ad | %s%d [%an] --graph --dateshort
git config --global alias.type cat-file -t
git config --global alias.dump cat-file -p
# log 只显示修改的文件
git config --global alias.ls log --stat
# log 只用一行显示信息
git config --global alias.one log --prettyoneline4.2 如果终端安装了oh-my-zsh会带一堆git命令别名
Mac 用户和 Linux 用户通过在您的终端中运行以下命令来安装oh-my-zsh
sh -c $(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)oh-my-zsh带的git命令别名
g - git
gst - git status
gl - git pull
gup - git pull --rebase
gp - git push
gd - git diff
gdc - git diff --cached
gdv - git diff -w $ | view
gc - git commit -v
gc! - git commit -v --amend
gca - git commit -v -a
gca! - git commit -v -a --amend
gcmsg - git commit -m
gco - git checkout
gcm - git checkout master
gr - git remote
grv - git remote -v
grmv - git remote rename
grrm - git remote remove
gsetr - git remote set-url
grup - git remote update
grbi - git rebase -i
grbc - git rebase --continue
grba - git rebase --abort
gb - git branch
gba - git branch -a
gcount - git shortlog -sn
gcl - git config --list
gcp - git cherry-pick
glg - git log --stat --max-count10
glgg - git log --graph --max-count10
glgga - git log --graph --decorate --all
glo - git log --oneline --decorate --color
glog - git log --oneline --decorate --color --graph
gss - git status -s
ga - git add
gm - git merge
grh - git reset HEAD
grhh - git reset HEAD --hard
gclean - git reset --hard git clean -dfx
gwc - git whatchanged -p --abbrev-commit --prettymedium
gsts - git stash show --text
gsta - git stash
gstp - git stash pop
gstd - git stash drop
ggpull - git pull origin $(current_branch)
ggpur - git pull --rebase origin $(current_branch)
ggpush - git push origin $(current_branch)
ggpnp - git pull origin $(current_branch) git push origin $(current_branch)
glp - _git_log_prettily参考资料
https://segmentfault.com/a/1190000007145316
https://www.hinjin.com/2018/04/13/%E5%A6%82%E4%BD%95%E5%8A%A0%E5%BF%AB%E4%BD%A0%E7%9A%84git%E6%93%8D%E4%BD%9C%EF%BC%9F/
4.3 GIT配置文件介绍
4.3.1 Linux、Mac OS系统
Git 使用一系列配置文件来保存你自定义的行为。 它首先会查找 /etc/gitconfig 文件该文件含有系统里每位用户及他们所拥有的仓库的配置值。 如果你传递 --system 选项给 git config它就会读写该文件。 接下来 Git 会查找每个用户的 ~/.gitconfig 文件或者 ~/.config/git/config 文件。 你可以传递 --global 选项让 Git 读写该文件。 最后 Git 会查找你正在操作的版本库所对应的 Git 目录下的配置文件.git/config。 这个文件中的值只对该版本库有效。 以上三个层次中每层的配置系统、全局、本地都会覆盖掉上一层次的配置所以 .git/config 中的值会覆盖掉 /etc/gitconfig 中所对应的值。
4.3.2 windows系统
windows7系统 C:\Documents and Settings\用户名其中有一个.gitconfig的文件。 windows8系统 C盘 - 用户(Users) - 用户名 文件夹下有个.gitconfig的文件。
在上述那个目录底下 可发现另外一个文件.git-credentials里面记录的就是用户名密码了。
5. git设置远程仓库账号密码(拉取、上传代码不用输入用户名密码)
github Personal access tokens
使用token可以不需要密码就可以读取远程仓库代码如果你的远程仓库网站提供了账户访问token那么设置一个access tokens。
github网站登陆后 点击右上角的用户图标 - settings - 选择 Developer settings - 选择 Personal access tokens或者打开链接https://github.com/settings/tokens
使用
git clone https://github.com/username/repo.git
username: your email
Password: your access tokens由于github在2021-08-13禁止了用户名、密码形式所以需要使用如下形式
# git clone https://oauth2:[access tokens]github.com/user/repo
git clone https://oauth2:ghp_GjguOh******KZmgithub.com/user/repo
# 修改仓库
git remote set-url origin https://oauth2:ghp_GjguOh******ThzKZmgithub.com/user/repo码云仓库有类似的码云 私人令牌
git-credentials git读取账号密码文件
这里是为了你在拉取代码的时候不用在输入用户名密码了 但是这里会暴露你远程仓库的用户名密码注意保密如果电脑不用了记得删除这个文件。
# 打开文件如果没有则会自动创建文件
$ vim ~/.git-credentials
# 编辑好文件后运行git命令来让文件生效
$ git config --global credential.helper store里面文件内容
http://用户名:密码或token仓库地址
http://yulilong:password192.168.102.9
https://yulilong:passwordbitbucket.org
http://yulilong:passwordbitbucket.org
https://yulilong:5199818388420github.com
http://yulilong:github_Personal_access_tokensgithub.com6. git文件夹详解 探索.git目录 .git文件夹详解 Git 内部原理
7. 图形软件操作工具
有的可能不适应命令行的复杂 所以有一款图形化操作软件并且带终端的软件。
网址https://git-scm.com/
下载地址https://git-scm.com/downloads
这个软件在window下自带命令行工具 可以直接在打开文件夹中鼠标右键用命令行打开这个文件夹使用非常方便。b