📖
Wiki
Back to my personal website
  • Home
  • Equipment and Devices
    • 3D Printer
    • Laser Cutter
    • Motion Capture System
    • Sensors
      • RGB-D Cameras
      • Velodyne LiDAR
      • Zed Camera
      • RealSense D435i
      • IMU
    • eGPU
    • Nvidia AGX Xavier
    • CPU Benchmark
    • Installation Checklist
  • Development
    • Linux
      • Shell
      • GDB
      • Git
      • Tmux
      • Network
      • Tricks
      • Debug FAQ
    • CMake
      • Catkin Tools
      • CMakeLists
      • CMake Variables
      • CMake Commands
      • CMake: find_package()
    • ROS
      • Gazebo
      • wstool
      • roslaunch
      • rosbag
      • multi-threaded spinner
    • ROS2
      • Convert ROS1 bag to ROS2 bag
    • C++
      • C++ 11
      • C++ Examples
      • C++ Debug
      • Factory Method
      • Timing
    • Google Tools
      • GLog
      • GFlags
      • GTest
      • Style Guide
      • Clang Format
    • PCL
      • Point Type
      • Methods
      • Architecture
      • Code Explained
    • Open3D
      • Python API
      • Registration
      • Visualization
      • Tools
    • OpenCV
      • Documentation
      • Modules
    • Other Libraries
      • Eigen
      • Ceres
      • g2o
      • GTSAM
    • Website
  • Algorithm
    • SLAM
      • K-D Tree
      • Octree
      • Bag of Words
      • Distance Measures
      • Coordinate Systems
      • LOAM
      • Iterative Closest Point
      • Generalized ICP
      • Mahalanobis Distance
    • Computer Science
      • Computational Model
      • Sorting
      • Analysis
      • Complexity Classes (P, NP)
      • Divide and Conquer
      • Greedy Algorithm
      • Dynamic Programming
      • Tree
      • Graph
    • Computer Vision
      • Camera Models
      • Distortion
      • Motion Models
      • Shutter
      • Image Sensors
      • Epipolar Geometry
      • Multiple-View Geometry
    • Datasets
      • RGB-D Datasets
      • Point Cloud Datasets
      • LiDAR SLAM Datasets
  • Math
    • Optimization
      • Convex Optimization
      • Descent Methods
    • Probability
      • Moment
      • Covariance Matrix
      • Stochastic Process
    • Topology
      • References
      • Concepts
      • Topological Spaces
      • Representation of Rotations
      • Representation of 3-sphere
    • Algebra
      • Linear Algebra
      • Matrix Factorization
      • Condition Number
      • Matrix Lie Group
    • Differential Geometry
      • Manifold
      • Submanifold
      • Quotient Manifolds
      • Tangent Space
  • Quadrotor
    • PX4 Development
    • Companion Computer
    • Drone Hardware
    • Propeller Lock
    • Debug
  • Favorites
    • Bookmarks
Powered by GitBook
On this page

Was this helpful?

  1. Development
  2. Linux

Git

  • git branch -vv check for remote repo connection

  • git branch -r/-a list remote/all branches

  • git branch -u origin/<branch> set the upstream branch for current branch

  • git blame <file-name> check for contributors

  • git cherry-pick <commit1> <commit2> ... pick commits and append to current HEAD

  • git config --global user.email "email@example.com"

  • git config --global user.name "Your Name"

  • git config --global alias.s status use git s in short for git status

  • git config --global push.default simple

  • git config --global pull.ff only

  • git config --global core.autocrlf true/false/input

  • git config --global --unset <entry-name> unset global configuration

  • git clone -b <branch-name> --single-branch <url>

  • git commit --amend re-commit the last commit

  • git checkout - go to previous branch

  • git checkout <branch>/<commit-id>/<tag>

  • git checkout -b <branch> create a new branch and checkout to it

  • git checkout -b <branch> origin/<branch> also specify the upstream branch

  • git checkout <file-name> undo a file to the last commit (valid before git add this file)

  • git clean <file-name> -f remove untracked file

  • git clean <directory-name> -df remove untracked directory

  • git clean -X -f remove files ignored by .gitignore

  • git diff --staged/cached diff between last commit and staged files

  • git diff <id1> <id2>

  • git diff <branch1> <branch2>

  • git describe --tags --abbrev=0 most recent tag in current branch

  • git log --graph --pretty=oneline --decorate --all

  • git push --force force update remote repo (overwrite commits in remote repo)

  • git push origin master will push local master to remote master, regardless of current branch

  • git push origin <source>:<destination> push local source branch to remote destination branch where source could also be a location represented by HEAD~1 or master^

  • git push origin :foo push nothing to a remote branch foo will delete this branch

  • git fetch origin :foo fetch nothing to a local branch foo will create this new branch

  • git pull = git fetch + git merge; two branches in history

  • git pull --rebase = git fetch + git rebase; a single line in history (recommended)

  • git rm <file-name> -f remove a staged file and delete it from file system

  • git rm <file-name> --cached remove a staged file but still keep it in working directory

  • git reset <file-name> move a file from staging to working directory

  • git reset --hard/--soft/--mixed <commit-id>

  • git remote -v to see the current remote URL

  • git remote set-url origin <newurl> reset URL for origin

  • git revert <commit-id> go back to this commit by adding a new commit

  • git reflog see all history operations

  • git rebase <branch> merge into a single line by making copies of new commits

  • git rebase -i interaction mode (can pick commits)

  • git stash

  • git stash list/pop/apply/drop/clear

  • git show <branch-name>:<file-name>

  • git status --ignored show files ignored by .gitignore

  • git tag <name>

  • git tag -ln check for detailed info

  • git update-index --assume-unchanged <path/to/file> untrack/hide a file

  • git update-index --no-assume-unchanged <path/to/file> track/unhide a file

PreviousGDBNextTmux

Last updated 3 years ago

Was this helpful?

references: ; ;

Version Control with Git
Learn Git Branching
How to undo almost anything with git