Table of contents
- Pulling down the latest changes from master
- List remote branches:
- Create a branch to isolate feature or bug-fix
- To keep your feature branch fresh and up to date with the latest changes in master
- Push branch remotely
- Perform a final rebase cleanup after the pull request has been approved
- Merge Branch into Master
- Use the "ours" merge strategy to overwrite master with branchname
A gitignore file specifies intentionally untracked files that Git should ignore.1
Ignored files are usually build artifacts and machine generated files that can be derived from your repository source or should otherwise not be committed. Some common examples are (https://www.atlassian.com/git/tutorials/saving-changes/gitignore):
- dependency caches, such as the contents of /node_modules or /packages
- compiled code, such as .o, .pyc, and .class files
- build output directories, such as /bin, /out, or /target
- files generated at runtime, such as .log, .lock, or .tmp
- hidden system files, such as .DS_Store or Thumbs.db
- personal IDE config files, such as .idea/workspace.xml
The gitignore file is an essential part of a Git repository. Various files should not be deployed to a production environment or shared between development environments. "A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected." (https://git-scm.com/docs/gitignore) There are standard templates for IDE's, such as JetBrains, VSCode, and Sublime, there are also templates for CMS/Frameworks, such as Django, Drupal, WordPress, and Larval. gitignore.io provides a command line interface to include various templates into a .gitignore file, https://docs.gitignore.io/install/command-line.
- gitignore documentation
- Ignoring files - From time to time, there are files you don't want Git to check in to GitHub. There are a few ways to tell Git which files to ignore.
- Common .gitignore
To run gitignore.io from your command line you need an active internet connection and an environment function. You need to add a function to your environment that lets you access the gitignore.io API.
gi linux,macos,windows,jetbrains,python >> .gitignore
$ git checkout master $ git fetch origin $ git merge master
A branch represents an independent line of development.2
- Git Branching - Branches in a Nutshell
- Git Branching - Branch Management
- Git Branching - Basic Branching and Merging
$ git branch -a
$ git checkout -b PRJ-123-awesome-feature
- Feature branch - Used for specific feature work or improvements. Generally, branch from, and merge back into, the development branch using pull requests.
- Bugfix branch - Typically used to fix Release branches.
- Hotfix branch - Used to quickly fix a Production branch without interrupting changes in the development branch.
$ git fetch origin $ git rebase origin/master
$ git push -u origin PRJ-123-awesome-feature
$ git rebase -i origin/master
$ git checkout master $ git pull origin master $ git merge --no-ff PRJ-123-awesome-feature
$ git checkout ''branchname'' $ git merge -s ours master $ git checkout master $ git merge ''branchname''
$ git tag
$ git tag -a v1.4 -m 'my version 1.4'
$ git tag v1.4-lw
$ git checkout -b version2 v2.0.0