[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-573219-105":53,"doc-detail-573219-en":126},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":119,"head_meta":121,"extra_data":123,"updated_unix":125},105,"en","git-cheat-sheet-git-basics-command-reference","Git Cheat Sheet - Git Basics - Command Reference","","Concise reference for core Git workflows, covering repository initialization, cloning, author configuration, staging changes, committing with messages, and inspecting status and logs. Includes comparison commands for working tree vs index (diff), undo strategies via revert and reset, and history editing through amend and rebase with reflog visibility. Adds practical coverage of branch creation, switching, merging, plus remote repository operations such as add, fetch, pull, and push, along with common log formatting and filtering options.",{"@graph":63,"@context":118},[64,80,101],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/git-cheat-sheet-git-basics-command-reference/573219/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/git-cheat-sheet-git-basics-command-reference/573219.png","ImageObject",442,249,{"name":88,"@type":89},"Levi","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-18","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":76},"InteractionCounter",{"@type":100},"ViewAction",{"@type":102,"mainEntity":103},"FAQPage",[104,110,114],{"name":105,"@type":106,"acceptedAnswer":107},"How do you initialize a new Git repository in a specified directory?","Question",{"text":108,"@type":109},"Use git init \u003Cdirectory> to create an empty repo in that directory. Without arguments, git init initializes the current directory as a repository.","Answer",{"name":111,"@type":106,"acceptedAnswer":112},"What is the difference between git diff, git diff HEAD, and git diff --cached?",{"text":113,"@type":109},"git diff shows unstaged changes between your index and working directory. git diff HEAD compares the working directory to the last commit, while git diff --cached compares staged changes to the last commit.",{"name":115,"@type":106,"acceptedAnswer":116},"How can you undo changes in Git safely?",{"text":117,"@type":109},"Use git revert \u003Ccommit> to create a new commit that undoes changes from \u003Ccommit>. Use git reset \u003Cfile> to remove a file from the staging area while leaving the working directory unchanged.","https://schema.org",{"og:url":78,"og:type":120,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":122,"canonical":78},"index,follow",{"doc_id":124,"site_id":56},573219,1792014834,{"code":4,"msg":5,"data":127},{"doc_id":124,"user_id":128,"nickname":88,"user_avatar":129,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":76,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":9,"language":135,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":136,"faqs":137,"seo_title":138,"seo_description":61,"update_tm":139,"read_time":4},7971461740909,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","Git Cheat Sheet  \nGIT BASICS  \n\n| git init \u003Cdirectory> | 在指定的目录下创建一个空的git repo。不带参数将在当前目录下创建一个git repo。 | Create empty Git repo in speciﬁed directory. Run with no arguments to initialize the current directory as a git repository. |\n| --- | --- | --- |\n| git clone \u003Crepo> | 克隆一个指定repo到本地。指定的repo可以是本地文件系统或者由[HTTP](HTTP)或SSH指定的远程路径。 | Clone repo located at \u003Crepo> onto local machine. Original repo can be located on the local ﬁlesystem or on a remote machine via [HTTP or SSH](HTTP or SSH). |\n| git config\u003Cbr>[user.name](user.name) \u003Cname> | 针对当前repo配置用户名。使用--global 参数将配置全局用户名。 | Deﬁne author name to be used for all commits in current repo. Devs commonly use--global ﬂag to set conﬁg options for current user. |\n| git add \u003Cdirectory> | 将指定目录的所有修改加入到下一次 commit中。把\u003Cdirectory>替换成\u003Cﬁle>将添加指定文件的修改。 | Stage all changes in \u003Cdirectory> for the next commit. Replace \u003Cdirectory> with a \u003Cﬁle> to change a speciﬁc ﬁle. |\n| git commit-m\"\u003Cmessage>\" | 提交暂存区的修改，使用指定的\u003Cmessage>作为提交信息，而不是打开文本编辑器输入提交信息。 | Commit the staged snapshot, but instead of launching a text editor, use \u003Cmessage> as the commit message. |\n| git status | 显示哪些文件已被staged、未被staged以及未跟踪(untracked)。 | List which ﬁles are staged, unstaged, and untracked. |\n| git log | 以缺省格式显示全部commit历史。更多自定义参数请参考后续部分。 | Display the entire commit history using the default format. For customization see additional options. |\n\nGIT DIFF  \n\n| git diff | 比较工作区和暂存区的修改。 | Show unstaged changes between your index and working directory. |\n| --- | --- | --- |\n| git diff HEAD | 比较工作区和上一次commit后的修改。 | Show diﬀerence between working directory and last commit. |\n| git diff--cached | 比较暂存区和上一次commit后的修改。 | Show diﬀerence between staged changes and last commit |\n\nUNDOING CHANGES  \n\n| git revert \u003Ccommit> | 对指定\u003Ccommit>创建一个undo的 commit，并应用到当前分支。 | Create new commit that undoes all of the changes made in \u003Ccommit>, then apply it to the current branch. |\n| --- | --- | --- |\n| git reset \u003Cfile> | 将\u003Cﬁle>从暂存区移除，但保持工作区不变。此操作不会修改工作区的任何文件。 | Remove \u003Cﬁle> from the staging area, but leave the working directory unchanged. This unstages a ﬁle without overwriting any changes. |\n\nREWRITING GIT HISTORY  \n\n| git commit-m\u003Cbr>\u003Cmessage> --amend | 将当前staged修改合并到最近一次的 commit中。 | Replace the last commit with the staged changes and last commit combined. |\n| --- | --- | --- |\n| git rebase \u003Cbase> | 基于\u003Cbase>对当前分支进行 rebase。\u003Cbase>可以是commit、分支名称、 tag或相对于HEAD的commit。 | Rebase the current branch onto \u003Cbase> . \u003Cbase> can be a commit ID, branch name, a tag, or a relative reference to HEAD. |\n| git reflog | 显示本地repo的所有commit 日志。 | Show a log of changes to the local repository’s HEAD. |\n\nGIT BRANCHES  \n\n| git branch | 显示本地repo的所有分支。 | List all of the branches in your repo. |\n| --- | --- | --- |\n| git switch-c \u003Cbranch> | 创建并切换到一个新的名为\u003Cbranch>的分支。去掉-c参数将切换到一个已有分支。 | Create and switch to a new branch named \u003Cbranch> . Drop the-c ﬂag to switch to an existing branch. |\n| git merge \u003Cbranch> | 将指定\u003Cbranch>分支合并到当前分支。 | Merge \u003Cbranch> into the current branch. |\n\n\n| REMOTE REPOSITORIES |  |  |\n| --- | --- | --- |\n| git remote add \u003Cname> \u003Curl> | 添加一个新的远程连接。添加后可使用\u003Cname>作为指定\u003Curl>远程连接的名称。 | Create a new connection to a remote repo. After adding a remote, you can use \u003Cname> as a shortcut for \u003Curl> in other commands. |\n| git fetch\u003Cbr>\u003Cremote> \u003Cbranch> | 从指定\u003Cremote>抓取指定\u003Cbranch>的所有commit到本地repo。去掉\u003Cbranch>将抓取远程所有分支的修改。 | Fetches a speciﬁc \u003Cbranch>, from the repo. Leave oﬀ\u003Cbranch> to fetch all remote refs. |\n| git pull \u003Cremote> | 从指定\u003Cremote>抓取所有分支的commit 并立刻合并到本地repo。 | Fetch the speciﬁed remote’s copy of current branch and immediately merge it into the local copy. |\n| git push \u003Cremote>\u003Cbranch> | 将本地指定\u003Cbranch>推送到指定远程\u003Cremote> 。如果远程没有对应的分支，将自动在远程创建此分支。 | Push the branch to \u003Cremote>, along with necessary commitsand objects. Creates named branch in the remote repo if it doesn’t exist. |\n\nGIT CONFIG  \n\n| git config--global [user.name](user.name)[ ](user.name)\u003Cname> | 配置当前用户名，使用--global参数将针对当前系统登录用户生效。 | Deﬁne the author name to be used for all commits by the current user. |\n| --- | --- | --- |\n| g","cbCairoqJrUwEzdo","https://ap.wps.com/l/cbCairoqJrUwEzdo","pdf",111922,"English","# GIT BASICS\n## GIT DIFF\n## UNDOING CHANGES\n## REWRITING GIT HISTORY\n## GIT BRANCHES\n## REMOTE REPOSITORIES\n## GIT CONFIG\n## GIT LOG\n## GIT RESET","[{\"question\":\"How do you initialize a new Git repository in a specified directory?\",\"answer\":\"Use git init \\u003cdirectory\\u003e to create an empty repo in that directory. Without arguments, git init initializes the current directory as a repository.\"},{\"question\":\"What is the difference between git diff, git diff HEAD, and git diff --cached?\",\"answer\":\"git diff shows unstaged changes between your index and working directory. git diff HEAD compares the working directory to the last commit, while git diff --cached compares staged changes to the last commit.\"},{\"question\":\"How can you undo changes in Git safely?\",\"answer\":\"Use git revert \\u003ccommit\\u003e to create a new commit that undoes changes from \\u003ccommit\\u003e. Use git reset \\u003cfile\\u003e to remove a file from the staging area while leaving the working directory unchanged.\"}]","Git Cheat Sheet - Git Basics - Command Reference | PDF",1791934858]