Skip to main content

Posts

Showing posts with the label git

Git Tip 💡

> Git aliases: Making aliases for popular commands to save time in the terminal is one of the most effective ways to enhance your everyday workflow. The most used Git commands like checkout, commit, etc. can be made into aliases using the following commands: -> git config --global alias.co checkout -> git config --global alias.ct commit Now, we only need to type "git co main" rather than "git checkout main". Likewise, type "git ct main" rather than "git commit main". We can also edit directly the .gitconfig file for the same purpose: [alias]     co = checkout     ct = commit

single-branch parameter in the git clone

Despite having a small amount of storage on your local, do you need to do a task in a specific branch of git? Or, for a variety of reasons, you might only wish to clone a certain branch's files? Git, fortunately, allows the flexibility to accomplish this with single-branch parameter. What is the single-branch parameter in the git clone? It allows you to only fetch files from the specified branch and only tracks that branch without fetching other branches. git clone -b <branchname> — single-branch <remote-repo-url> Or git clone — branch <branchname> — single-branch <remote-repo-url>