git-everyday¶
什么是git
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
安装git¶
首先确保你的电脑上安装了git,你可以去官网下载,然后按照指示安装即可。
在命令行查看版本号确保git安装成功了:
$ git --version
git version 2.39.2 (Apple Git-143)
git工作流¶
最简单的git工作流就是下面的几个操作:
graph LR
subgraph local
work((workspace))
stage((stage))
repo((repository))
work--add--->stage--commit--->repo
stage--restore--->work
repo--reset--->stage
end
subgraph remote
remoterepo[(repository)]
end
remoterepo--pull--->repo
repo--push--->remoterepo 安装git的时候也会一并安装git的手册,其中包含了一个giteveryday的文档:
$ man giteveryday
<pre style="color:white;">
NAME
giteveryday - A useful minimum set
of commands for Everyday Git
SYNOPSIS
Everyday Git With 20 Commands Or So
DESCRIPTION
Git users can broadly be grouped into four categories
for the purposes of describing here a small set of
useful command for everyday Git.
• Individual Developer (Standalone) commands are essential
for anybody who makes a commit, even for
somebody who works alone.
• If you work with other people, you will need commands
listed in the Individual Developer
(Participant) section as well.
• People who play the Integrator role need to learn some
more commands in addition to the above.
• Repository Administration commands are for system
administrators who are responsible for the care and
feeding of Git repositories.
</pre>
这个手册包含了在git日常使用的几个场景下经常用到的命令:
个人开发 (独立)¶
git-initto create a new repository.git-logto see what happened.git-switchandgit-branchto switch branches.git-addto manage the index file.git-diffandgit-statusto see what you are in the middle of doing.git-committo advance the current branch.git-restoreto undo changes.git-mergeto merge between local branches.git-rebaseto maintain topic branches.git-tagto mark a known point.
个人开发 (协作)¶
git-clonefrom the upstream to prime your local repository.git-pullandgit-fetchfrom "origin" to keep up-to-date with the upstream.git-pushto shared repository, if you adopt CVS style shared repository workflow.git-format-patchto prepare e-mail submission, if you adopt Linux kernel-style public forum workflow.git-send-emailto send your e-mail submission without corruption by your MUA.git-request-pullto create a summary of changes for your upstream to pull.
集成人¶
git-amto apply patches e-mailed in from your contributors.git-pullto merge from your trusted lieutenants.git-format-patchto prepare and send suggested alternative to contributors.git-revertto undo botched commits.git-pushto publish the bleeding edge.
管理员¶
git-daemonto allow anonymous download from repository.git-shellcan be used as a restricted login shell for shared central repository users.git-http-backendprovides a server side implementation of Git-over-HTTP ("Smart http") allowing both fetch and push services.gitwebprovides a web front-end to Git repositories, which can be set-up using thegit-instawebscript.
此外还包含了很多的场景实例,你可以去读一读。
学习git¶
learnGitBranching是一个很好用的在线交互式git学习网站:
git GUI¶
PyCharm、VSCode等代码编辑器一般都集成了Git的功能,你可以使用他们提供的git GUI来操作:
最后更新: 2024-10-21 16:46:00
创建日期: 2024-10-21 16:46:00
创建日期: 2024-10-21 16:46:00
广告
人要恰饭的嘛🤑🤑
