Tags are useful to mark specific versions or releases of your code in a repo on a given branch. To tag everything on the current branch, use:
git tag new-tag-name
To push a new tag to a remote repo, you can either push all tags (which is not recommended):
git push remote-name --tags
or push a specific tag:
git push remote-name tag-name
More example in this SO question.
To avoid committing files to version control you can add their names to a .gitignore file, and to committing local changes to an already version controlled file you can use the git command described in my previous post here.
How can you remove history if you’ve already committed a file? For example, let’s say you have a properties file with some environment specific values that you’ve committed, but you want to remove the history of those committed values?
This FAQ walks through the steps needed, which in summary are:
- Remove all history from the repo:
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch path/to/your_file_name'
--prune-empty --tag-name-filter cat -- --all
- on Windows, replace the ‘ with “
- add the filename to .gitignore if you want to avoid future commits (and commit .gitignore: git commit -m “updated gitignore” )
- push changes back to your remotes: git push remotename master –force
If you need to make local changes to a tracked file and then not commit them in future commit, use the ‘git update-index -skip-worktree’ as described here.