Sometimes we don’t need commit history from long time ago, and only want to keep last n commits. For example: Let’s say we want to perform this operation on our main branch, and backup the previous status as another branch main_old, then force push new main branch to the remote. The PowerShell script above willContinue reading “Create New Branch Only Contains Last N Commits”
Tag Archives: Git
Shallow Git Repository
Create Shallow Repository Just run shallow fetch command: Unshallow Checkout official doc for more info. Remove Unused Remote Branch Update Fetch Config We can edit the git config file to determine which branches should be fetched automatically. As you see, we could change the fetch config in the remote section to tell Git which branchContinue reading “Shallow Git Repository”
Git LFS
Enable LFS Install & Track First of all, install lfs for git using following command: Then add track of large files using lfs: Note that the command above will also update .gitattributes file automatically. Migrate Steps above will only handle future large files. To migrate large file to LFS storage for previous commits, we couldContinue reading “Git LFS”