第三章:Git使用入门

1.安装Git

       apt-get install git

       apt-get install git-doc git-svn git-email git-gui gitk

2.将文件提交到本地版本库:git commit

# cd /demo/helloworld-git

# echo “helloworld” > helloworld.txt

# git add helloworld.txt

# git commit -m ‘helloworld-master’

# git log

3.使用sudo passwd root命令设置root密码

4.切换本地分支:git checkout

# git checkout new-branch(将当前本地分支切换到new-branch)

# echo ‘世界你好’ > helloworld.txt

# git add helloworld.txt

# git commit -m helloworld-new-branch

5.如果使用RHEL、Fedorah和CentOS用一下命令安装Git

       yun install git

       yun install git-doc git-svn git-email git-gui gitk

.上传源代码到GitHub: git push

# ssh-keygen -t rsa -C “helloworld@126.com”(备份)

# git config --global user.name”Your Name”

# git config --global user.email helloworld@126.com

# git remote add origin git@github.com:androidguy/helloworld.git(设置GitHub上的URL)

# git push -u origin master(上传)

7.从GitHub下载源代码:git clone

# git clone git@github.com:androidguy/helloworld.git(下载整个工程)

# git pull otigin master(获取某一分支)

http://www.cnblogs.com/ITmin/

posted on 2016-04-29 14:07  IT敏  阅读(137)  评论(0)    收藏  举报

导航