Git Commands Cheat Sheet

    The list above is a
Git Commands Cheat Sheet, providing an overview of essential Git commands used in version control systems. Git is a distributed version control system that allows developers to track changes in their codebase, collaborate on projects, and manage multiple versions of their code.


    Git Commands Cheat Sheet

    1. git diff: Show file differences that are not yet staged.
    2. git commit -a -m "commit message": Commit all tracked changes with a message.
    3. git commit --amend: Modify the last commit.
    4. git status: Display the state of your working directory.
    5. git add file_path: Add file(s) to the staging area.
    6. git checkout -b branch_name: Create and switch to a new branch.
    7. git checkout branch_name: Switch to an existing branch.
    8. git checkout : Switch the working directory to a specific commit.
    9. git push origin branch_name: Push a branch to the remote repository.
    10. git pull: Fetch and merge changes from the remote repository.
    11. git fetch: Fetch changes from the remote repository without merging.
    12. git rebase -i: Rebase interactively to rewrite commit history.
    13. git rebase branch_name: Rebase the current branch onto another branch.
    14. git clone <repository_url>: Create a local copy of a remote repository.
    15. git merge: Merge branches together.
    16. git log --stat: Show commit logs with statistics.
    17. git stash: Temporarily save changes for later.
    18. git stash pop: Apply and remove stashed changes.
    19. git show commit_id: Show details about a specific commit.
    20. git reset HEAD~1: Undo the last commit, keeping the changes locally.
    21. git branch -D branch_name: Forcefully delete a branch.
    22. git reset: Undo commits by moving the branch reference.
    23. git revert commit_id: Create a new commit that undoes the changes of a specific commit.
    24. git cherry-pick commit_id: Apply changes from a specific commit.
    25. git branch: List all branches.
    26. git reset --soft HEAD^: Undo the last commit but keep the changes staged.
    27. git reset --hard: Reset everything to a previous commit, erasing all uncommitted changes.
    28. git branch --set-upstream-to remote_branch: Set the upstream branch to the specified remote branch.


    Comments

    Popular posts from this blog

    ChatGPT

    Flutter Build apps for any screen