- Must specify Master branch in first push.
- Use
git push -u origin master
instead ofgit push origin master
as the former will recordorigin/master
as a remote tracking branch, and will enable the next push to automatically push master toorigin/master
. - Read more
Useful for switching context and working on something else, especially when mid-way through a code change and aren't ready to commit.
- Git doesn't have a traditional 'undo' system like word processing tools.
- Refrain from mapping Git operations to any traditional 'undo' mental model.
- Helpful metaphor is to think of Git as a timeline where commits are a snapshot of time
- "Undoing" would mean moving back in time.
git log
to get a list of latst commits.git log --oneline
for more concise log.
git revert
ideal for public and shared repos whilegit reset
better for local changes.
git remote
- The git remote command lets you create, view, and delete connections to other repositories.
- origin Remote
- When cloning a repo with
git clone
, automatically creates remote connection called origin pointing back to cloned repo.
- When cloning a repo with
- Continue with Atlassian lessons