---
title: "git基本使用"
author: "hxl1988_0311"
date: "2014-11-06T15:21:23Z"
tags: []
categories: ["开源软件"]
slug: "git"
draft: false
lastmod: "2014-11-06T15:21:23Z"
id: 2153013
url: "https://sosop.iteye.com/blog/2153013"
---

1.git config

/etc/gitconfig     --system

~/.gitconfig       --global

.git/config

 

git config --list

 

2.git init

git clone url

.gitignore

git add     git status    git diff    git diff --cache    git commit

git rm       git rm --cache    git mv from to

git log -p -times    git log --stat    git log --pretty=oneline

git log --since/--after/--utile/--before=2.weeks2014-11-08/

git log --author/--commiter=

 

3.git commit --amend再次补提

取消暂存区：git reset HEAD filename

取消修改：    git checkout -- filename

 

4.远程仓库

git remote

git remote -v

添加远程仓库：git remote add shortname url

git fetch remotename

git push remotename remotebranch

git remote show origin

git remote rename old new

git remote rm repname

 

5.标签

git tag

git tag -l 'v1.\*'

git tag -a v1.0 -m “”

git show v1.0

git tag -a v1.2 9fceb02

git push origin v1.0

git push origin --tags

git config --global alias.co checkout