Skip to main content

Posts

Showing posts with the label git

GIT : forking workflow

Forking Workflow  : https://www.atlassian.com/git/workflows The Forking Workflow is fundamentally different than the other workflows discussed in this tutorial. Instead of using a single server-side repository to act as the “central” codebase, it gives every  developer a server-side repository. This means that each contributor has not one, but two Git repositories: a private local one and a public server-side one.  

clone a single branch from git repo

git clone -b <branch> --branch <branch> --single-branch git://github/repository.git --[no-]single-branch Clone only the history leading to the tip of a single branch, either specified by the  --branch  option or the primary branch remote's  HEAD  points at. When creating a shallow clone with the  --depth option, this is the default, unless  --no-single-branch  is given to fetch the histories near the tips of all branches. Further fetches into the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning. If the HEAD at the remote did not point at any branch when  --single-branch  clone was made, no remote-tracking branch is created.

HOWTO remove all dangling commits from your git repository

A good explanation of the dangling ( fr: ballants) commits source tells you how they get created. git fsck --full   Checking object directories: 100% (300/300), done. Checking objects: 100% (10658/10658), done. dangling commit x.... dangling blob y.... dangling commit z.... dangling blob w.... dangling blob a.... dangling commit b.... How to quickly remove those? git reflog expire --expire=now --all git gc --prune=now

push and delete remote branches

This is an action that many Git users need to do frequently, but many (including the me!!) have forgotten how to do so or simply don’t know how. Here’s the definitive guide if you’ve forgotten. For this reason I put it on my dev site on cofares the with free articles resources galaxy of sites. So you have checked out a new branch, committed some awesome changes, but now you need to share this branch though with another developer. You can push the branch up to a remote very simply: git push origin <pascal> Where origin is your remote name and <pascal> is the name of the branch you want to push up. Deleting is also a pretty simple task: git push origin :<pascal> That will delete the newfeature branch on the origin remote, but you’ll still need to delete the branch locally with   git branch -d <pascal>

GIT: Remove sensitive data

From time to time users accidentally commit data like passwords or keys into a git repo. While you can use   git rm   to remove the file, it will still be in the repo's history. Fortunately, git makes it fairly simple to remove the file from the entire repo history. Change your files This step should be blatantly obvious, but some users still skip it. If you committed a password, change it! If you committed a key, generate a new one. If you commited private files remove them. Once the commit has been pushed you should consider the data to be compromised. Purge the file from your repo Now that the password is changed, you want to remove the file from history and add it to the .gitignore  to ensure it is not accidentally re-committed. For our examples, we're going to remove Rakefile  from the  GitHub gem  repo. $ git clone https://github.com/defunkt/github-gem.git # Initialized empty Git repository in /Users/tekkub/tmp/github-gem/.git/ # remot...