git init
Create a new repository. Turn an existing directory into a git repository.
git config --global user.name "[user name]"
Set the configuration variable that informs the name of the user
git config --global user.email "[user email]"
Set the configuration variable that informs the email of the user
git status
Report the status of repository files
git add * --all
Add any new or modified file to the index
git clone [URL repository git]
Clone (download) a repository that already exists on server git (GitHub, GitLab, etc), including all of the files, branches, and commits
git branch
Creates a new branch
git branch -a
git branch -r
git branch -v
git checkout
git checkout -b [branch name]
Create a new branch in local
git checkout [branch name]
Switches to the specified branch and updates the
working directory
git pull
Updates your current local working branch with all new
commits from the corresponding remote branch on server git (GitHub, GitLab, etc). The command git pull is a combination of git fetch and git merge
git pull origin master
git push origin master
git push origin -u master
git push origin -u master --all
git push origin -u master --tags
git remote -v
git remote rename origin [name new origin]
Ex.: git remote rename origin origin2
git remote add origin [name new origin] [URL repository git]
Add a new origin.
Ex.: git remote add origin http://11.54.127.44/gitlab/poc-kafka-avro-integration-two-apps/shuttle.git
Ex.: git remote add origin http://11.54.127.44/gitlab/poc-kafka-avro-integration-two-apps/shuttle.git
git remote remove origin
Remove current origin
git rm -f -r --cached kafka
git add kafka
git add kafka
Remove submodule kafka and add to father git
git commit -m "[content message commit]"
Commit changes on local repository
git fetch
Downloads all history from the remote tracking branches
git merge
Combines remote tracking branch into current local branch
git push
Uploads all local branch commits to GitHub
git checkout [name branch destination]
git merge [name branch origin]
git push
Git merge in other branch: name branch destination
git checkout [name branch destination]
git merge --no-ff [name branch]
git push
Git merge no fast forward in other branch: name branch destination
git branch -d [name branch]
Remove branch
git log
Lists version history for the current branch
git log --follow [file]
Lists version history for a file, including renames
git diff [first-branch]...[second-branch]
Shows content differences between two branches
git show [commit]
Outputs metadata and content changes of the specified commit
git add [file]
Snapshots the file in preparation for versioning
git commit -m "[descriptive message]"
Records file snapshots permanently in version history
git reset [commit]
Undoes all commits after [commit], preserving changes locally
git reset --hard [commit]
Discards all history and changes back to the specified commit
git push origin --delete main
Delete remote branch remotes/origin/main