Loading...
 
Git Core Processes

Git Processes

gitignore

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 Command Line Tool

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.

Examples

Appending Programming Language settings to your projects .gitignore.
gi linux,macos,windows,jetbrains,python >> .gitignore

Pulling down the latest changes from master

$ git checkout master
$ git fetch origin
$ git merge master

Branches

A branch represents an independent line of development.2

List remote branches:

$ git branch -a

Create a branch to isolate feature or bug-fix

$ git checkout -b PRJ-123-awesome-feature

Branch Types3

  • 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.

To keep your feature branch fresh and up to date with the latest changes in master

$ git fetch origin
$ git rebase origin/master

Push branch remotely

$ git push -u origin PRJ-123-awesome-feature

Perform a final rebase cleanup after the pull request has been approved

$ git rebase -i origin/master

Merge Branch into Master

$ git checkout master
$ git pull origin master
$ git merge --no-ff PRJ-123-awesome-feature

Use the "ours" merge strategy to overwrite master with branchname

$ git checkout ''branchname''
$ git merge -s ours master
$ git checkout master
$ git merge ''branchname''

Tagging

Git Basics - Tagging

Listing Your Tags

$ git tag

Annotated Tags

$ git tag -a v1.4 -m 'my version 1.4'

Lightweight Tags

$ git tag v1.4-lw

Checking out Tags

$ git checkout -b version2 v2.0.0

Last edited by MichaelAlber .
Page last modified on Sunday July 28, 2019 02:18:34 UTC.