git checkout -b branch-name
to create and switch to a new branch.
git branch -d branch-name
to delete a branch locally.
git clone https://github.com/username/repo.git
to copy the remote repository to your machine.
git branch -m old-name new-name
to rename a branch.
git log filename
to view the commit history for a specific file.
git reset
moves HEAD and optionally modifies the working directory. git revert
creates a new commit that undoes a previous commit.
git push origin branch-name
to push a branch to the remote repository.
git branch -d branch-name
to delete a branch locally. Use -D
to force delete.
git cherry-pick
applies the changes introduced by a specific commit from another branch onto your current branch.
git clone https://github.com/username/repo.git
to create a local copy of a remote GitHub repository.
git branch -m old-name new-name
to rename the branch you're on. For a different branch, use git branch -m branch-name new-name
.
git log filename
to display all commits related to a particular file.
git reset
moves the HEAD and can change history. git revert
adds a new commit that undoes a previous commit without modifying history.
git push origin branch-name
to upload your branch to the GitHub repository.
git diff commit1 commit2
to view changes made between two commits.
git checkout -- filename
or git restore filename
to discard uncommitted changes in a file.
git pull
to fetch and merge changes from the remote repository into your current branch.
git add
and git commit
to complete the merge.
git fetch
followed by git rebase origin/main
while on your branch to apply your commits on top of the latest main branch.
git diff
to show changes in the working directory not yet staged.
git rm --cached filename
to remove a file from the index but keep it on disk.
Git LFS (Large File Storage)
to manage large files such as datasets and model weights.
GitHub Actions
to write workflows that test AI models automatically during CI/CD pipelines.
git init
to initialize a new local Git repository.
git add filename
to start tracking a new file.
git revert commit_id
to safely create a new commit that undoes the changes.
git status
to view which files are staged for commit.
git tag v1.0
to create one.
git checkout -- filename
to discard local changes in your working directory.
git branch -d branchname
for local and git push origin --delete branchname
for remote.
git stash apply
to reapply the latest stash or git stash pop
to apply and remove it.
git branch
for local branches and git branch -r
for remote branches.
git clone -b branchname --single-branch url
.
git fetch upstream
followed by git merge upstream/main
.
git log --graph --oneline --all
or Git GUI tools like GitKraken or SourceTree.