[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-571426-105":53,"doc-detail-571426-en":127},{"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":120,"head_meta":122,"extra_data":124,"updated_unix":126},105,"en","git-cheat-sheet-git-basics-undoing-changes","Git Cheat Sheet - GIT BASICS - UNDOING CHANGES","","Git Cheat Sheet provides a compact reference for common Git workflows, commands, and practical usage. It covers repository setup (init, clone), author configuration (user.name, user.email), staging and committing changes (add, commit), and basic inspection (status, log, diff). It also explains undoing work, reverting commits, and resetting behavior, followed by branch management, remote repository operations, and rewriting history via amend and rebase.",{"@graph":63,"@context":119},[64,80,102],{"@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-undoing-changes/571426/",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-undoing-changes/571426.png","ImageObject",442,249,{"name":88,"@type":89},"Sarah ","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-21","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",7,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"How do you create and clone a Git repository?","Question",{"text":109,"@type":110},"Use git init \u003Cdirectory> to initialize a repository and git clone \u003Crepo> to copy an existing repository locally.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"How can you undo changes in Git?",{"text":114,"@type":110},"Use git revert \u003Ccommit> to create a new commit that undoes changes, or use git reset \u003Cfile> to unstage without overwriting working directory changes.",{"name":116,"@type":107,"acceptedAnswer":117},"What commands help rewrite commit history?",{"text":118,"@type":110},"Use git commit --amend to replace the last commit, and git rebase \u003Cbase> (or git rebase -i \u003Cbase>) to rebase the current branch onto a new base.","https://schema.org",{"og:url":78,"og:type":121,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":123,"canonical":78},"index,follow",{"doc_id":125,"site_id":56},571426,1792015515,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":101,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":136,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":61,"update_tm":140,"read_time":9},962085320529,"https://ap-avatar.wpscdn.com/davatar_9964176cb1d06d4a9deccf72a44ae3dc","Git Cheat Sheet  \nGIT BASICS  \n\n| git init \u003Cdirectory> | Create empty Git repo in specified directory. Run with no\u003Cbr>arguments to initialize the current directory as a git repository. |\n| --- | --- |\n| git clone \u003Crepo> | Clone repo located at \u003Crepo> onto local machine. Original repo can be located on the local filesystem or on a remote machine via [HTTP](HTTP or SSH)[ or](HTTP or SSH)[ SSH](HTTP or SSH). |\n| git config\u003Cbr>[user.name](user.name) \u003Cname> | Define author name to be used for all commits in current repo. Devs commonly use--global flag to set config options for current user. |\n| git add \u003Cdirectory> | Stage all changes in \u003Cdirectory> for the next commit. Replace \u003Cdirectory> with a \u003Cfile> to change a specific file. |\n| git commit-m\"\u003Cmessage>\" | Commit the staged snapshot, but instead of launching\u003Cbr>a text editor, use \u003Cmessage> as the commit message. |\n| git status | List which files are staged, unstaged, and untracked. |\n| git log | Display the entire commit history using the default format. For customization see additional options. |\n| git diff | Show unstaged changes between your index and\u003Cbr>working directory. |\n| UNDOING CHANGES |  |\n\ngit revert \u003Ccommit>  \nCreate new commit that undoes all of the changes made in \u003Ccommit>, then apply it to the current branch.  \ngit  \ngit  \nreset \u003Cfile>  \nclean-n  \nRemove \u003Cfile> from the staging area, but leave the working directory unchanged. This unstages a file without overwriting any changes.  \nShows which files would be removed from working directory. Use the-f flag in place of the-n flag to execute the clean.  \nREWRITING GIT HISTORY  \n\n| git commit--amend | Replace the last commit with the staged changes and last commit combined. Use with nothing staged to edit the last commit’s message. |  |\n| --- | --- | --- |\n| git rebase \u003Cbase> | 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\u003Cbr>Show a log of changes to the local repository’s HEAD.\u003Cbr>Add--relative-date flag to show date info or--all to show all refs. |  |  |\n| GIT BRANCHES |  |  |\n| git branch |  | List all of the branches in your repo. Add a \u003Cbranch> argument to create a new branch with the name \u003Cbranch>. |\n| git checkout-b |  | Create and check out a new branch named \u003Cbranch>. |\n| \u003Cbranch> |  | Drop the-b flag to checkout an existing branch. |\n| git merge \u003Cbranch> |  | Merge \u003Cbranch> into the current branch. |\n| REMOTE REPOSITORIES |  |  |\n\ngit remote add \u003Cname> \u003Curl>  \ngit fetch  \n\u003Cremote> \u003Cbranch>  \ngit pull \u003Cremote>  \ngit push  \n\u003Cremote> \u003Cbranch>  \nCreate a new connection to a remote repo. After adding a remote, you can use \u003Cname> as a shortcut for \u003Curl> in other commands.  \nFetches a specific \u003Cbranch>, from the repo. Leave off \u003Cbranch> to fetch all remote refs.  \nFetch the specified remote’s copy of current branch and immediately merge it into the local copy.  \nPush the branch to \u003Cremote>, along with necessary commits and objects. Creates named branch in the remote repo if it doesn’t exist.  \nVisit [atlassian.com/git](atlassian.com/git) for more information, training, and tutorials  \nAdditional Options +  \nGIT CONFIG  \n\n| git config--global [user.name](user.name) \u003Cname> | Define the author name to be used for all commits by the current user. |\n| --- | --- |\n| git config--global [user.email](user.email) \u003Cemail> | Define the author email to be used for all commits by the current user. |\n| git config--global alias. \u003Calias-name>\u003Cgit-command> | Create shortcut for a Git command. E.g. alias.glog “log--graph\u003Cbr>--oneline”will set ”gitglog”equivalent to ”git log--graph--oneline. |\n| git config--system core.editor \u003Ceditor> | Set text editor used by commands for all users on the machine. \u003Ceditor> arg should be the command that launches the desired editor (e.g., vi). |\n| git config\u003Cbr>--global--edit | Open the global configuration file in a text editor for manual editing. |\n| GIT LOG |  |\n| git log-\u003Climit> | Limit number of commits by \u003Cl","cbCaibE8uVt233Qw","https://ap.wps.com/l/cbCaibE8uVt233Qw","pdf",71399,"English","# Git Basics\n## Undoing Changes\n## Rewriting Git History\n## Git Branches\n## Remote Repositories\n## Git Configuration\n## Git Log","[{\"question\":\"How do you create and clone a Git repository?\",\"answer\":\"Use git init \\u003cdirectory\\u003e to initialize a repository and git clone \\u003crepo\\u003e to copy an existing repository locally.\"},{\"question\":\"How can you undo changes in Git?\",\"answer\":\"Use git revert \\u003ccommit\\u003e to create a new commit that undoes changes, or use git reset \\u003cfile\\u003e to unstage without overwriting working directory changes.\"},{\"question\":\"What commands help rewrite commit history?\",\"answer\":\"Use git commit --amend to replace the last commit, and git rebase \\u003cbase\\u003e (or git rebase -i \\u003cbase\\u003e) to rebase the current branch onto a new base.\"}]","Git Cheat Sheet - GIT BASICS - UNDOING CHANGES | PDF",1791916937]