Find and get rid of really big files from your git repo: https://rtyley.github.io/bfg-repo-cleaner/ Handy tool for getting rid of stale bug/feature branches that have already been merged in to the main release/master branches: https://github.com/arc90/git-sweep
Let’s say I have a feature branch called “feature-x” which I want to first rebase onto the “develop” branch. Then it is first best practice to squash all my feature-branch’s commits into a single commit and then merge it into the develop branch via a pull request. first checkout the . . . Read more
do the following to add new branch to stash: git clone profiles repo: git clone ssh://github.com/in/projectname.git git checkout new-base-profiles git branch temporary-branch-name # creates new branch git checkout temporary-branch-name # make changes to files. git add git commit git push origin temporary-branch-name then on stash -> create pull request source . . . Read more
If there is file that is being tracked by git, but is a file you now want to delete. Then the best way to do it is by running the following git command: $ git remove filename.txt This command does 2 things, it first changes the file’s state to untrack, . . . Read more
A git project is made up of 3 parts: Working directory – This is the directory where all your project files and folders reside (along with the .git folder). Each of your files within this directory is in 1 of possible states, untracked, unmodified, modified, staged. Will cover more about . . . Read more
If you want to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it like this git fetch origin git reset –hard origin/master http://git-scm.com/blog/2011/07/11/reset.html
To view a list of all branches do: git branch -a the one that has an asterix next to it is the one that is currently checked out.
There are 3 common things you may want to undo when using git: undo a commit unstage a file unmodify a file If you have done several commits and you want to roll back several commits, then do: git log -p This will list commit id’s pick the id you . . . Read more
Simply run: git log the log command has a huge number of options available: git log -2 # means only show the last 2 entries git log -p -2 # same as above but also show diff data. git stat # shows info in a more summarised form.