Git从创建到推送到远程版本库

来源:互联网 发布:java comp env jdbc 编辑:程序博客网 时间:2024/05/28 20:20
1、创建一个新的文件夹,并进入到该文件夹里,使用命令:git init来创建新的git仓库;

2、获取钩子(每次git init之后都要一次): scp -p -P 8849 lining@ip:hooks/commit-msg .git/hooks/

3、从远程仓库中把代码克隆到本地,检出仓库:
本地仓库的克隆:git clone /path/to/repository
远程仓库的克隆:git clone username@host:/path/to/repository

4、创建分支:git branch ‘分支名称’

5、添加到缓存区:git add <filename>

6、提交到本地版本库:git commit -m "代码提交信息"

7、推送到远程版本库:git push origin master
0 0