Lorenzo Vainigli

Software developer, passionate about programming

Git Commands

Here’s a list of useful commands to use Git.

Table of contents

  1. Basics
  2. Branching
  3. Tags
  4. Remove items
  5. Other

Basics

# Init a local repository
git init

# Clone a remote repository
git clone {remote_repository_url}

# Add remote to local repository
git remote add origin {remote_repository_url}

# Committing all changes
git add *
git commit -m "Commit message"

# Push to remote repository
git push origin master

Branching

# List all branches
git branch

# Change branch
git checkout {branch_name}

# Create a new branch
git checkout -b {branch_name}

# Push a branch to remote repository
git push origin {branch_name}

# Rename current branch
git branch -m {new_name}

Tags

# Add tags to the current commit
git tag -a {tag_name} -m "Tag message"

# Show tags
git tag

# Show tag data
git show {tag_name}

# Pushing all tags to the repository
git push origin --tags

# Delete local tag
git tag -d {tag_name}

# Delete remote tag
git push --delete origin {tag_name}

Remove items

# Remove remote directory
git rm -r --cached FolderName
git commit -m "Removed folder from repository"
git push origin master

Other

# List ignored files
git status --ignored

Hi 👋, I'm Lorenzo 👨🏻‍💻

🇮🇹 Italian
💼 Software developer
🎓 Master's degree in computer science

Tech interests
🤖 Artificial intelligence
🧠 Machine learning
📊 Data Analysis
🌐 Web development
📱 Android development
Other interests
🪐 Astronomy
🇯🇵 Japanese culture
🥋 Martial arts
🎮 Videogames
📸 Photography

More about me