Git is a distributed version control system that tracks changes in any set of computer files.
- Advanced Git Tips for Python Developers
- Interactive rebase— the ultimate git superpower
gh auth login
Git remove file that is already stored
git rm --cached -r <YOUR_files_or_folders>
Git Reset vs. Revert vs. Checkout reference
git stash command helps you stash your work away and clear your working directory. Then when you checkout it will not carry over the new code with you.
Lessons from Ericsson
Make your personal branch in a way that it can track the master:
- git checkout -b personal/$USER/pdcch origin/master
- git pull -r (to rebase)
- cherry pick: git fetch ssh://email@example.com:29418/lte/ebb refs/changes/04/12367804/1 && git cherry-pick FETCH_HEAD
gerrit ex: link, to download the patch, I see 4 options.
- repo download
Checkout: Fetches the latest changes. You should already have this repo downloaded. It does not merge those new changes but makes your working directory reflect them. And a name-less commit is created to include these changes in your working directory. And a detached HEAD pointing to it. You can merge them at your leisure later.
Pull: Fetches the changes AND merges them into the local branch of the same name.
Cherry-pick: Fetches the commit and plays it on top of the current local branch, thus creating an entirely new commit which happens to have same changes as the one it fetched.
- Setup your
~/.gitconfigso you can use shortcuts. I have my own
.gitconfigfile so typing commands is faster.
NEW: Since joining Ericsson, I’ve realized that it is even more productive to exclude the space. However, to do that, the aliases need to be written in the shell, i.e.
~/.zshrc instead of
alias ga `git add` alias gcm `git commit -m`
gst ga . gcm "insert message" gps
- What do you do if you just made a commit but then realize that
flake8has an error when you run it? Or you spot a typo in the commit message you just entered? Git will allow you to “amend” a commit:
g cm --amend "I am bad at spelling"