Categories: GIT

Git Add

Oct 30, 2020 1 min.

Git Version 2.x Command New File Modified File Deleted File Summary git add -A Y Y Y Stage new, modified, deleted git add . Y Y Y Stage new, modified, deleted git add --ignore-removal . Y Y N Stage new and modified files (Deleted files not staged) git add --u N Y Y Stage modified and deleted files (Added files not staged) To stage all changes use git add .

Remove Files From Git Repo as in Gitignore

May 15, 2019 1 min.

After you committed/pushed files to GIT repository, if you decide to ignore some files/directories using .gitignore then they won’t be automatically removed from git repository. Following command can be used for removing those ignored files from repo. TL;DR git rm -r --cached . git add . git commit -m ".gitignore fix" git push Detailed Explanation To remove the the ignored files/dirs from repo, use GIT remove command as follows. git rm -r --cached .

Git Squash

Nov 10, 2017 1 min.

Option 1 to squash last two commits git rebase -i HEAD~2 This will open editor where you can choose which commit to keep and which to squash. Also you have option to rewrite messages. Option 2 Reset and commit again: git reset --soft HEAD~2 git commit -m "New message for the combined commit" public class Test { public static void main(String[] args) { System.out.println("hello"); } } <section id="main"> <div> <h1 id="title">{{ .

Access GIT Using SSH Key

May 12, 2016 1 min.

Create SSH Key Create a SSH (private/public) key using the following command ssh-keygen -t rsa -C "somerefname" The above command asks for phase phrase and either enter the pass phrase or press enter for no pass phrase. The above command generates following two files in your «home»/.ssh directory id_rsa Login to your GIT hosting server (e.g. or and import the public key into your profile.