Update all git project in current directory - makefile

I have all my git project in the current directory
tox
Python-pattern
Click
...
How to update all with git pull using make ?

A) Add a target that contains a shell loop over all subdirectories and execute git pull in every subdirectory.
Mark the target as .PHONY so it is executed everytime it is called.

Related

How to include files from another repo in Jekyll build?

When I run this, files changes from the copied /first-repo are being ignored by bundle exec. How can I make sure that the files from /first-repo are included?
#!/bin/bash
cd /first-repo;
git pull;
cd /second-repo;
git pull;
# copy folder from first repo to second repo
cp -rf /first-repo /second-repo/destination_folder;
git add -A;
git commit -m "update destination folder from first repo";
git push;
# build
bundle exec rake build_site;
Sounds like you could use a Git Submodule.
Continuing the example, in second-repo you can instantiate a git submodule of first-repo to get the whole first-repo repository as a directory inside second-repo. You can also use the Jekyll config include variable to specify what files from first-repo to use in second-repo.

Cannot PUSH recent commits to Github that have been pushed to Bitbucket

I have two remote repositories. One is private (Bitbucket) and the other public (Github). I had been pushing changes to Bitbucket using Github app and then pushing the same commit to Github repo using Xcode. However, recently I have been unable to PUSH the commits to Github and using SourceTree I get this error message:
This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.
This is how it looks from within SourceTree:
How can I get my Github repo to accept the most recent commits?
You have a pre-push hook which is telling you that you have git-lfs (large file support) enabled for this repository, but that it can't find the git-lfs program on your computer. The solution is to either remove the hook (which is located in .git/hooks/pre-push, as the error message says), or to fix your PATH so that it can find the git-lfs program.
It would have been enough to say that the .git directory is in the original local directory of your repository and you probably need a program like TextWrangler or similar, that shows the hidden files starting with a dot, to be able to see it and delete it by moving it to the trash (right click mouse). It took me one hour to figure out this. I hope no one else have to waste that time.
Here is the instructions for removing the pre-push file using Mac Terminal:
First: cd to the directory that is your local repository for your project. (The main folder that holds .xcodeproj and other files) The .git file is hidden but you can still access it by typing cd .git/hooks in terminal. If you type ls in terminal to view all files within the current directory, you'll notice the pre-push file. Type rm pre-push to remove the file. You should now be able to push to your remote repository. Just be sure to cd .. back a few times to your local directory for your project. Simple as that.

Add symlink file as file using Git on Windows

I have a big (more than 1000 files) VS C# project in git. I need to create a small demo project and use ten files from the big project. To create this new project, I added ten files with mklink (symlink) from the big project to the small. All changes in corresponding files in the big and small project are identical. Now I need to add the small project to a different (my own) git repo.
But symlink will not add in git :
(error: readlink("X.cs"): Function not implemented)
How to add the X.cs (symlink) file in git as a regular file?
I need all changes in X.cs (in big project) to be moved to X.cs (small project).
If adding symlinks to the index fails with error error: readlink("..."): Function not implemented, try to find this line in the local or global config:
[core]
symlinks = false
You need to set symlinks = true for a successful push. Default value (=true) if parameter does not exist or is not working correctly and it depends on the settings with which the repository was created.
Hardlinks do not work with GIT, as the file and hardlink are stored as separate files.
It works the same with git version 2.8 or above (I did not check versions less than 2.8)
The current answer(s) are out-of-date and require revision given recent changes.
The solutions given there isn't enough and isn't working.
There are still issues with the latest Git 2.12 on Windows (February 2017, 18 months after the OP's question)
In the context of working on what was called git-new-workdir in 2015 (the ability, form one clone, to have multiple working tree: this ended up being called git worktree), the Git developers were asking how to reference those worktrees from the main cloned repo.
Would they be using ln? or its Windows equivalent mklink?
This thread, at the time, highlighted the issues:
When running on Windows in MinGW, creating symbolic links via ln always failed.
Using mklink instead of ln is the recommended method of creating links on Windows
That might be true, but not ideal: "Git Bash Shell fails to create symbolic links" does mention:
For my setup, that is Git for Windows 2.11.0 installed on Windows 8.1 export MSYS=winsymlinks:nativestrict does the trick as explained here: git-for-windows/pull/156
It's important to launch the Git Bash shell as administrator as on Windows only administrators could create the symbolic links. So, in order to make tar -xf work and create the required symlinks:
Run Git Bash shell as an administrator
Run export MSYS=winsymlinks:nativestrict
Run tar
See also "Git Symlinks in Windows", where the setup now (Git for Windows 2.10+) include symlink support:
You need to specify that during the clone:
git clone -c core.symlinks=true <URL>
And your CMD session needs to be run as admin.
Needless to say imposing that prerequisite on Windows users is a no-go (Windows in enterprise generally come with limited or no privilege elevation)
Yet, PR 156 does represent some Windows support for symlink, released in Git For Windows 2.10 (Sept. 2016).
It is telling that git worktree ended up implementing the multiple working tree reference... by not relying on symbolic links and by making the borrowee and borrowers aware of each other.
When you are done with a linked working tree you can simply delete it.
The working tree's administrative files in the repository will eventually be removed automatically (see gc.pruneworktreesexpire in git config), or you can run git worktree prune in the main or any linked working tree to clean up any stale administrative files.
So no symbolic link there.
git has problems with individual file links but it has no problem with directory symbolic links(mklink /d ). Therefore move your image files to another directory in your big project and create directory link in your git repo to this directory.
See below for example.
P:\denemeler\gitdeneme1>mklink /d linkDirectory P:\puzzles
Created symbolic link : linkDirectory <<===>> P:\puzzles
P:\denemeler\gitdeneme1>git status
On branch master Untracked files:
(use "git add ..." to include in what will be committed)
linkDirectory/
nothing added to commit but untracked files present (use "git add" to
track)
P:\denemeler\gitdeneme1>git add linkDirectory
P:\denemeler\gitdeneme1>git status
On branch master Changes to be
committed: (use "git reset HEAD ..." to unstage)
new file: linkDirectory/Juggle Fest Question.txt
new file: linkDirectory/jugglefest.txt
new file: linkDirectory/triangle.txt
new file: linkDirectory/triangleQuestion.txt
P:\denemeler\gitdeneme1>git commit -m "new files"
[master 0c7d126] new
files 4 files changed, 14150 insertions(+) create mode 100644
linkDirectory/Juggle Fest Question.txt create mode 100644
linkDirectory/jugglefest.txt create mode 100644
linkDirectory/triangle.txt create mode 100644
linkDirectory/triangleQuestion.txt
P:\denemeler\gitdeneme1>echo "aa" > p:\puzzles\newFile.txt
P:\denemeler\gitdeneme1>git status
On branch master Untracked files:
(use "git add ..." to include in what will be committed)
linkDirectory/newFile.txt
nothing added to commit but untracked files present (use "git add" to
track)
Git does indeed have trouble with symlinks on Windows. However, I don't think you even need symlinks for your problem. A simple workaround is to write a small *.bat script to copy the files in question from one repository to another on demand. With symlink, you don't need to run a script, which saves you a few seconds, but you get a problem that you can accidentally change file in small repository and have unwanted modification in big repository.
Looks like all your simlinks located in one ntfs partition, if it is true, you can renew all simlinks to hardlinks, by some script with command, mklink /h...
Hardlinks friendly for any CVS.

exporting a project in rubymine

I've created a project and now want to export it to another folder so I can do work on it. The project itself is a repository so thats why I don't just want to copy and paste the files (since I'll get the hidden .git files with it).
Is there a simple way to export a project in rubymine?
If you use GitHub you could push all current files to your repo, then (assuming you are on a *nix command line) mkdir and/or cd into the NEW folder that you want to work in. You could then perform a:
$ git clone git#github.com:username/projectyouwanttomove.git
Let me know if that helps or not.

Git Ignore Pattern for XCode Build Directory

I am new to Git, and this is my first project using Git rather than SVN as my source control. I am working in XCode on an iPhone project. I want Git to ignore the build directory, which is in the root folder of the XCode project. I've found several other questions here and also found articles on google that provide examples on how to create the .gitignore file in the root directory and then add it to the Git repository to get the directory to be ignored.
Here are the steps I'm taking when setting up the repository:
Open Terminal and navigate to the root directory of the application
Call git init to initialize the repository
Call git add .gitignore to add the gitignore file
Call git commit -m to commit the gitignore file
Call git status to view the status of the repository
At this point, all of the other directories and files listed in my gitignore file are properly ignored except the build directory. Here is what my gitignore file looks like:
build/
.DS_Store
**/*.pbxuser
*.mode2v3
*.mode1v3
**/*.perspectivev*
I have tried ignoring the build directory using the following different entries with no success:
build
build/
build/*
Anyone know what I'm doing wrong here?
build/ or build/* should be enough to ignore the directory.
See also "Difference between .gitignore rules with and without trailing slash like /dir and /dir/"
The only reasons it could be still not ignored at this point if it:
has somehow been added to the index and committed (which, according to your setup, shouldn't be the case)
has a trailing space (/build ) in the .gitignore file rule, as in this .gitconfig, before Git 2.0 (Q2 2014).

Resources