CodingBee

A beginners guide to programming and automating stuff

All posts in git

Git – Handy git tools and utilities

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

Git – Create a pull request

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

Git – useful links

http://stackoverflow.com/questions/292357/what-are-the-differences-between-git-pull-and-git-fetch

Git – Removing files

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

Git – The 3 main parts of git

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

Git – resetting Git.

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

Git – Intro to branches

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.

Git – Undoing things

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

Git – Viewing past commits

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.