Linus 为了托管内核代码的方便,创建了 Git。
之前,Linux 开发者使用的是 BitKeeper,不过社区对这个私有工具总是不放心,然后 BitKeeper 方面对于部分开发者试图逆向工程不满。
对于大多数公司来说, Git 的设计颇为复杂。
但是没办法,现在 Git 已经成为大多数开发者的选择。
基础命令
git config配置git init初始化当前目录为 git 仓库git clone克隆一个远程仓库到本地git add添加变更(提交之前的挑选)git commit提交变更git push推送变更到远程仓库git pull拉取远程仓库变更,并合并到本地;等于git fetch+git mergegit status查看变更状态git log查看提交历史git branch分支管理git checkout切换分支git fetch拉取远程仓库变更git merge合并分支
示例
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
git clone git@github.com:your-username/example
cd example
# 创建新文件
echo "hello" > newfile
git add newfile
git commit -m "Add newfile"
git push origin master