User Tools

Site Tools


newdevs:git:commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
newdevs:git:commands [2025/02/10 12:27] – added bash aliases, and some extra demonstrations of how to use aliases slearynewdevs:git:commands [2025/04/04 13:28] (current) – [Useful Git Commands] tmccanna
Line 52: Line 52:
   * ''git reset <nowiki>--hard HEAD</nowiki>'' --> remove last commit   * ''git reset <nowiki>--hard HEAD</nowiki>'' --> remove last commit
   * ''git reset <nowiki>--hard HEAD~2</nowiki>'' --> remove last 2 commits (increment numeral as needed)   * ''git reset <nowiki>--hard HEAD~2</nowiki>'' --> remove last 2 commits (increment numeral as needed)
 +  * ''git revert <hash>'' --> remove a specific commit from a branch that you've applied multiple commits to
   * ''git rm badfile.txt'' --> delete a file (if the file is being tracked, be sure to add a commit message indicating the file has been deleted)   * ''git rm badfile.txt'' --> delete a file (if the file is being tracked, be sure to add a commit message indicating the file has been deleted)
   * ''git show <hash>'' --> display the commit text and differences of the specified commmit   * ''git show <hash>'' --> display the commit text and differences of the specified commmit
Line 121: Line 122:
  
 <code>git co origin main</code> <code>git co origin main</code>
 +
 +==== Bash Aliases ====
  
 Mike Rylander suggests using bash aliases so you can skip typing ''git'': Mike Rylander suggests using bash aliases so you can skip typing ''git'':
newdevs/git/commands.1739208445.txt.gz · Last modified: 2025/02/10 12:27 by sleary

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.