debian安装git管理本地代码

安装git

# aptitude install git-core
# aptitude install git-doc git-svn git-email git-gui gitk

创建仓库

mkdir ~/repository                            # 创建git所有项目仓库目录
cd ~/repository # 跳转到上一步创建的目录
git init --bare example.git # 初始化一个example.git的空项目仓库
cd ~/project # 跳转的工作目录
git clone ~/repository/example.git # 克隆家目录中的空仓库 # 初始化项目
touch README
git add README
git commit -m 'Add README, initial project' README
git push origin master

设置bash显示分支名

export PS1="[\u@\h \W"'$(__git_ps1 " (%s)")'"]\$ "

设置alias[别名]

[alias]
co = checkout
st = status
ci = commit
cm = commit -m
br = branch
bm = branch -m
bd = branch -D
cb = checkout -b
df = diff
ls = log --stat
lp = log -p
plo = pull origin
plode = pull origin develop
pho = push origin

设置邮箱提示

设置忽略文件

*.aux
*.lof
*.out
*.toc
*.log
*.lot
*.pdf

参考资料


[1].Git短命令(alias,别名)

[2].如何架设Git服务器

[3].在 Shell 提示符中显示 Git 分支名称的方法

[4].配置别名

05-11 15:15