Showing posts with label Git. Show all posts
Showing posts with label Git. Show all posts

Wednesday, January 14, 2015

Git: Pulling in tags from remote

When working with a Git repository, you may find that you don't have the latest set of tags, or that a tag has moved, and your local repository does not reflect the update.   To update the tags in your local repository to reflect the remote, do the following:
git fetch --tags
This will pull down all tags on the current branch.

Wednesday, December 31, 2014

Delete a Remote Git Branch

To delete a branch from the server, do the following:
git push origin --delete serverfix

Saturday, December 27, 2014

File changes aren't ignored even when in the .gitignore file

If Git insists on checking in changes to a file even when the .gitignore file seems like it should be excluded, it is probably because the file is already in the repository.  Git will not ignore a file if it has already been committed.

To resolve this, open a Bash prompt in the root folder of the repository.   ( A shortcut for this in SourceTree is to click on the 'Actions/Open in Terminal' menu.   Run the following:
git rm --cached FolderName/MyFileName.ext
Then commit the change and push it up, and it should ignore the file from then on (assuming your .gitignore was correct to begin with).   Note that this will leave the file as is in your source folder.