Author Archives: stephen

How to fetch all the tags from a remote repository in git

To fetch all the tags from a remote repository, you can use the git fetch command with the --tags option. Here’s how you do it:

git fetch --tags

This command will fetch all tags from the remote repository, as well as the commits they point to. After fetching, the tags will be available in your local repository.

If you want to fetch both the tags and the branches updates, you can use:

git fetch --all

This will fetch all branches and tags from all remotes configured for your repository. However, if you only want to update your tags to match the remote repository (which might include deleting local tags that have been removed on the remote), you can use:

git fetch --prune --tags

The --prune option will delete any local remote-tracking references that no longer exist on the remote.

Remember that fetching tags will not automatically merge any changes into your current working branch. If a tag points to commit(s) that are not in your current branch’s history, you will need to merge or rebase to include those changes in your working branch.

How to get tag create user and create time from git

We can use git tag to get all the tags from a git repository, I also want to get the tag creator and create time, the following command can get all the tag create time and creator.

git log --tags --simplify-by-decoration --pretty="format:%ci %cn %d"

From the doc for git log PRETTY FORMATS, we can get that the options meaning like below:

%ci committer date, ISO 8601-like format

%cn committer name

%d ref names, like the — decorate option of git-log[1]

Android Studio Log Path

Today one of my Colleague find that after he upgrade the AndroidStudio, it can’t start on his Mac, so I want to see what’s the error is when start the Android Studio.

But I don’t know what’s the log directory for Android Studio, so I searched in the internet, and find that the log path for Android Studio is at Library/Logs/Google/AndroidStudio2021.3 The last part is the Android Studio with the version information. The log file for Android is idea.log.

Update wordpress max file upload size

I installed the wordpress several days ago, when I try to upload a featured image, it tell me that the max upload size is 2M, I updated the nginx setting, but php seems not get the value from nginx. I also searched the internet, and there are some suggestions, but it still does not work in my case, I described how I solved the problem in this article.

Continue reading

Use CachedMap to reduce database requests

In one of my project, there are some tables, and we save the id value of one table on another table, for example, we have album information, which has albumId and albumName fields, and on another table episode, it contain the albumId value, so when I query episode, I also want to get the albumName, and most of the albumId is the same.

Continue reading

Solved the Issue of substring not matching

In my project, I find a wired problem, we added More to an attribute string on swift, and set the different attribute for the last word More, but some times the word selected is not the More, but one letter less.

After debug the program, and find that it was caused by the string has html tag p on the string, and we removed part of the string in the end, and added More to the string, and add the string to NSAttributeString, and I find that the string with <p> in the beginning will add an \n to the end of the string.

I used the NSAttributeString.string method to get the pure string, and find that the end has \n.

Solution

The solution that I find is get the pure string before update data, so the html tag will be removed, and the string is correct right now.