`

some notes about git

    博客分类:
  • git
 
阅读更多

first step:

 

git config --global user.name "John Doe"

git config --global user.email johndoe@example.com

 

to add user name & email

 

then git config --list to check.

 

git help config to seek help.

 

You can get a Git project using two main approaches. The first takes an existing project or directory and imports it into Git. The second clones an existing Git repository from another server.

 

git init

 

git add *.html

git commit -m "first one"

 

now we build the repository here.

 

You clone a repository with git clone [url]. For example, if you want to clone the Ruby Git library called Grit, you can do so like this:

$ git clone git://github.com/schacon/grit.git

The main tool you use to determine which files are in which state is the git status command. 

 To stage it, you run the git add command (it’s a multipurpose command — you use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved).

If you want to see what you’ve staged that will go into your next commit, you can use git diff --cached. (In Git versions 1.6.1 and later, you can also use git diff --staged, which may be easier to remember.) This command compares your staged changes to your last commit:

 

Although it can be amazingly useful for crafting commits exactly how you want them, the staging area is sometimes a bit more complex than you need in your workflow. If you want to skip the staging area, Git provides a simple shortcut. Providing the -a option to the git commit command makes Git automatically stage every file that is already tracked before doing the commit, letting you skip the git

 

git commit -a -m "commit without staged"

 

To remove a file from Git, you have to remove it from your tracked files (more accurately, remove it from your staging area) and then commit. The git rm command does that and also removes the file from your working directory so you don’t see it as an untracked file next time around.

If you simply remove the file from your working directory, it shows up under the “Changes not staged for commit” (that is, unstaged) area of your git status output:

 

use git rm --cached to  keep the file in your working tree but remove it from your staging area.

 

git mv  can rename files

 

git log to check historial records. One of the more helpful options is -p, which shows the diff introduced in each commit. You can also use-2, which limits the output to only the last two entries:

分享到:
评论

相关推荐

    git-release-notes:从git commit历史记录生成发行说明页面

    npm install -g git-release-notes 也可以使用git-release-notes作为节点模块。 检查 用法 命令行的基本用法是 cd git-release-notes <since>..<until> 在哪里 <since>..指定提交范围,如git log ,请参见 是用于...

    Hubery-Lee#Notes#Git简易入门1

    1.git的简要介绍及安装 2.git简易入门命令 3.链接与资源

    Liuliu-55#papernotes#Git 笔记1

    使用git在笔记本电脑和主机间进行obsidian笔记同步在主机进行git push origin master后笔记本电脑git pull gitee mas

    Git-2.38.1-64-bit windows

    安装完成后,开发者可以通过命令行(如PowerShell或cmd)使用Git命令,如`git clone`克隆远程仓库,`git add`跟踪新文件,`git commit`保存更改,`git push`将本地更改推送到远程仓库,以及`git pull`拉取并合并远程...

    git-notes:Git和GitHub笔记

    Git是世界上最流行的分布式版本控制系统,它允许开发人员追踪和管理代码变更,协同开发项目。GitHub则是基于Git的一个在线平台,提供了代码托管、协作编辑、问题跟踪、版本控制等一系列功能,是全球开发者交流与合作...

    weitw#Notes#Git提交大文件管理1

    1. 安装依次执行以下命令sudo apt-get install git-lfs2. 使用方法执行 git lfs install ,这条命令每个仓库下只需要

    ZhongJinHacker#notes#git_merge和git_rebase总结1

    文件可能会发生冲突,需要解决一下最后结果* 85ef130 (HEAD -> master) Merge branch 'dev'可以看出,merge 有保留d

    tinypumpkin#MyNotes#git版本控制1

    1. 到文件下初始化 2. 添加文件hive复习.md 3. 合并添加和提交,以及注释 4. 查看日志 2. 合并分支(把“目标分支”合并到“当前分支”)she

    git-release-notes, 从git提交历史生成发行说明页.zip

    git-release-notes, 从git提交历史生成发行说明页 发行说明从git提交历史生成发行说明页。安装最好通过 npm 全局安装它。npm install -g git-release-notes用法基本用法是cd <your_git_project&

    caojx-git#learn-java-notes#Git处理 GitHub 不允许上传超过 100MB 文件的问题1

    1.1 移除错误缓存 1.2 重新提交 2.2 将想要保存的大文件正常添加进 git 2.3 正常进行提交&推送 2.4 补充技巧 2.5 常见问题

    ZhongJinHacker#notes#git_cherry-pick总结1

    cherry-pick : 精心挑选,挑选一个我们需要的 commit 进行操作。它可以用于将在==其他分支==上的 commit 移植到==当前的分支==。

    Git-2.39.1-64-bit

    Git for Windows focuses on offering a lightweight, native set of tools that bring the full feature set of the Git SCM to Windows while providing appropriate user interfaces for experienced Git users ...

    git every thing you need know about git

    The first edition of this book is what got me hooked on Git. This was my intro- duction to a style of making software that felt more natural than anything I had seen before. I had been a developer for...

    Github、git 学习笔记.pdf

    个人github、git学习笔记。包含Github和git的基础命令和介绍。由于网络问题在国外很难插入图片,把源文件的pdf导出版本进行上传。

    git notes.pdf

    Git版本控制系统详解 Git是Linus Torvalds设计的分布式版本控制系统,以解决Linux内核代码管理问题。Git具有分布式开发、本地有完整的版本库、支持和推广基于分支来开发、性能优越等特点。 Git工作模式分为四大域...

    progit第二版中文版

    progit第二版中文版 kindle格式 ----- 第一版出版到现在已经过去了四年。到今天,Git 虽然出现了许多改变,但是还有很多重要的事情一如昨日。因为 Git 核心团队对保持向后兼容性异常固执,所以直到今天大多数核心...

    git压缩包下载git下载

    Git是世界上最流行的分布式版本控制系统,它允许开发人员协作开发代码并跟踪每一次更改。"git压缩包下载git下载"这个标题和描述可能指的是提供Git的安装程序压缩包的下载服务。在本篇中,我们将深入探讨Git的核心...

    git-notes:通过Git自动同步您的个人笔记

    Git笔记 您的个人笔记通过Git同步Git Notes处于Alpha阶段。 我想和想使用Git Notes的用户聊天。 请加入。 Git Notes是一个本地安装的应用程序,可检测Git存储库中的更改并将更改立即推送到Github,Gitlab或您自己的...

    Git-1.9.0 git

    Git的主要操作包括初始化仓库(`git init`)、添加文件到暂存区(`git add`)、提交更改(`git commit`)、查看提交历史(`git log`)、分支管理(`git branch`和`git merge`)、远程仓库交互(`git clone`、`git ...

Global site tag (gtag.js) - Google Analytics