filmov
tv
Git Workflow #Git #github #tutorial #commands #code #codecommunity #workflow #luckyxplorer #shorts

Показать описание
Git Workflow #Git #github #tutorial #commands #code #codecommunity #workflow #luckyxplorer #shortsviral
Here is a summary of essential Git commands, grouped by function:
Setup and Initialization
git init: Initializes a new Git repository.
git clone repository_url: Creates a local copy of a remote repository.
Basic Workflow
git add file(s): Stages changes in specific files for commit.
git add .: Stages all changes in the working directory.
git commit -m "Commit message": Commits staged changes with a description.
git status: Shows the status of the working directory and staging area.
git log: Displays the commit history.
Branching and Merging
git branch: Lists all local branches.
git branch new_branch: Creates a new branch.
git checkout branch_name: Switches to the specified branch.
git checkout -b new_branch: Creates and switches to a new branch.
git merge branch_name: Merges the specified branch into the current branch.
git branch -d branch_name: Deletes the specified branch.
Remote Repositories
git remote add origin repository_url: Adds a remote repository named "origin".
git push origin branch_name: Pushes local changes to the remote repository.
git pull origin branch_name: Updates the local repository with changes from the remote.
git fetch origin: Downloads objects and refs from another repository.
Undoing Changes
git reset --soft HEAD~1: Rewinds the last commit, keeping changes staged.
git reset --hard HEAD~1: Discards the last commit and all changes.
git revert commit_hash: Creates a new commit that undoes the changes from a specific commit.
git stash: Temporarily saves changes that you don't want to commit immediately.
git stash pop: Restores the most recently stashed changes.
Other Commands
git diff: Shows changes between the working directory and the staging area.
git clean -fd: Removes untracked files and directories.
git tag tag_name: Creates a tag at the current commit.
git rebase: Reapplies commits on top of another base commit.
Here is a summary of essential Git commands, grouped by function:
Setup and Initialization
git init: Initializes a new Git repository.
git clone repository_url: Creates a local copy of a remote repository.
Basic Workflow
git add file(s): Stages changes in specific files for commit.
git add .: Stages all changes in the working directory.
git commit -m "Commit message": Commits staged changes with a description.
git status: Shows the status of the working directory and staging area.
git log: Displays the commit history.
Branching and Merging
git branch: Lists all local branches.
git branch new_branch: Creates a new branch.
git checkout branch_name: Switches to the specified branch.
git checkout -b new_branch: Creates and switches to a new branch.
git merge branch_name: Merges the specified branch into the current branch.
git branch -d branch_name: Deletes the specified branch.
Remote Repositories
git remote add origin repository_url: Adds a remote repository named "origin".
git push origin branch_name: Pushes local changes to the remote repository.
git pull origin branch_name: Updates the local repository with changes from the remote.
git fetch origin: Downloads objects and refs from another repository.
Undoing Changes
git reset --soft HEAD~1: Rewinds the last commit, keeping changes staged.
git reset --hard HEAD~1: Discards the last commit and all changes.
git revert commit_hash: Creates a new commit that undoes the changes from a specific commit.
git stash: Temporarily saves changes that you don't want to commit immediately.
git stash pop: Restores the most recently stashed changes.
Other Commands
git diff: Shows changes between the working directory and the staging area.
git clean -fd: Removes untracked files and directories.
git tag tag_name: Creates a tag at the current commit.
git rebase: Reapplies commits on top of another base commit.