Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 27/07/2015, à 05:16

ubuntuforce

besoin d'aide pour utilisation de git.

Salut les Ubuntues,

Mon problème est énoncer dans le titre du poste: j'ai vraiment une utilisation basique de git
+ le programme, qui est vaste et comporte de multiples options.
+ et donc la forge a programme github.

Par exemple si je veut mettre a jours un dépôt la solution que j'utilise est d'effacer le dépôt et de le recréer immédiatement après en uploadant de nouveau toutes les données (incluant ceux qui ont changé).
Cela fonctionne mais je trouve la solution assez barbare !!!

Par exemple si je désire rajouter une image a la page de présentation du dépôt comme celle de l'éditeur de texte avec terminaux intégrés IT-Edit a un dépôt dont la page de présentation ne contient pas d'image et bien je serai forcer d'utiliser la méthode expliquer au-dessus.

En faîte la seule chose que je sais faire d'autre est d'éditer un fichier (texte) grâce a l'interface du site...

Et je désirerai savoir faire un peu plus comme:

+ Ajouter un fichier a un endroit précis du dépôt.
+ Ajouter un dossier récursivement a mon dépôt.
+ Effacer un dossier récursivement de mon dépôt.
Vous voyez tout concerne la gestion de fichier et de dossier du dépôt.

Ne m'envoyer pas vers la manpage de git car celle-ci me renvoie vers les manpages suivantes:
J'aimerai plutôt que vous m'aidiez concernant les opérations que je vous ai enoncer.

Merci pour vos réponses éclairées et pour votre précieuse aide.

Extrait de man git:

Main porcelain commands
       git-add(1)
           Add file contents to the index.

       git-am(1)
           Apply a series of patches from a mailbox.

       git-archive(1)
           Create an archive of files from a named tree.

       git-bisect(1)
           Find by binary search the change that introduced a bug.

       git-branch(1)
           List, create, or delete branches.

       git-bundle(1)
           Move objects and refs by archive.

       git-checkout(1)
           Checkout a branch or paths to the working tree.

       git-cherry-pick(1)
           Apply the changes introduced by some existing commits.

       git-citool(1)
           Graphical alternative to git-commit.

       git-clean(1)
           Remove untracked files from the working tree.

       git-clone(1)
           Clone a repository into a new directory.

       git-commit(1)
           Record changes to the repository.

       git-describe(1)
           Show the most recent tag that is reachable from a commit.

       git-diff(1)
           Show changes between commits, commit and working tree, etc.

       git-fetch(1)
           Download objects and refs from another repository.

       git-format-patch(1)
           Prepare patches for e-mail submission.

       git-gc(1)
           Cleanup unnecessary files and optimize the local repository.

       git-grep(1)
           Print lines matching a pattern.

       git-gui(1)
           A portable graphical interface to Git.

       git-init(1)
           Create an empty Git repository or reinitialize an existing one.

       git-log(1)
           Show commit logs.

       git-merge(1)
           Join two or more development histories together.

       git-mv(1)
           Move or rename a file, a directory, or a symlink.

       git-notes(1)
           Add or inspect object notes.

       git-pull(1)
           Fetch from and integrate with another repository or a local branch.

       git-push(1)
           Update remote refs along with associated objects.

       git-rebase(1)
           Forward-port local commits to the updated upstream head.

       git-reset(1)
           Reset current HEAD to the specified state.

       git-revert(1)
           Revert some existing commits.

       git-rm(1)
           Remove files from the working tree and from the index.

       git-shortlog(1)
           Summarize git log output.

       git-show(1)
           Show various types of objects.

       git-stash(1)
           Stash the changes in a dirty working directory away.

       git-status(1)
           Show the working tree status.

       git-submodule(1)
           Initialize, update or inspect submodules.

       git-tag(1)
           Create, list, delete or verify a tag object signed with GPG.

       gitk(1)
           The Git repository browser.

   Ancillary Commands
       Manipulators:

       git-config(1)
           Get and set repository or global options.

       git-fast-export(1)
           Git data exporter.

       git-fast-import(1)
           Backend for fast Git data importers.

       git-filter-branch(1)
           Rewrite branches.

       git-mergetool(1)
           Run merge conflict resolution tools to resolve merge conflicts.

       git-pack-refs(1)
           Pack heads and tags for efficient repository access.

       git-prune(1)
           Prune all unreachable objects from the object database.

       git-reflog(1)
           Manage reflog information.

       git-relink(1)
           Hardlink common objects in local repositories.

       git-remote(1)
           manage set of tracked repositories.

       git-repack(1)
           Pack unpacked objects in a repository.

       git-replace(1)
           Create, list, delete refs to replace objects.

       Interrogators:

       git-annotate(1)
           Annotate file lines with commit information.

       git-blame(1)
           Show what revision and author last modified each line of a file.

       git-cherry(1)
           Find commits yet to be applied to upstream.

       git-count-objects(1)
           Count unpacked number of objects and their disk consumption.

       git-difftool(1)
           Show changes using common diff tools.

       git-fsck(1)
           Verifies the connectivity and validity of the objects in the
           database.

       git-get-tar-commit-id(1)
           Extract commit ID from an archive created using git-archive.

       git-help(1)
           Display help information about Git.

       git-instaweb(1)
           Instantly browse your working repository in gitweb.

       git-merge-tree(1)
           Show three-way merge without touching index.

       git-rerere(1)
           Reuse recorded resolution of conflicted merges.

       git-rev-parse(1)
           Pick out and massage parameters.

       git-show-branch(1)
           Show branches and their commits.

       git-verify-tag(1)
           Check the GPG signature of tags.

       git-whatchanged(1)
           Show logs with difference each commit introduces.

       gitweb(1)
           Git web interface (web frontend to Git repositories).

   Interacting with Others
       These commands are to interact with foreign SCM and with other people
       via patch over e-mail.

       git-archimport(1)
           Import an Arch repository into Git.

       git-cvsexportcommit(1)
           Export a single commit to a CVS checkout.

       git-cvsimport(1)
           Salvage your data out of another SCM people love to hate.

       git-cvsserver(1)
           A CVS server emulator for Git.

       git-imap-send(1)
           Send a collection of patches from stdin to an IMAP folder.

       git-p4(1)
           Import from and submit to Perforce repositories.

       git-quiltimport(1)
           Applies a quilt patchset onto the current branch.

       git-request-pull(1)
           Generates a summary of pending changes.

       git-send-email(1)
           Send a collection of patches as emails.

       git-svn(1)
           Bidirectional operation between a Subversion repository and Git.

LOW-LEVEL COMMANDS (PLUMBING)
       Although Git includes its own porcelain layer, its low-level commands
       are sufficient to support development of alternative porcelains.
       Developers of such porcelains might start by reading about git-update-
       index(1) and git-read-tree(1).

       The interface (input, output, set of options and the semantics) to
       these low-level commands are meant to be a lot more stable than
       Porcelain level commands, because these commands are primarily for
       scripted use. The interface to Porcelain commands on the other hand are
       subject to change in order to improve the end user experience.

       The following description divides the low-level commands into commands
       that manipulate objects (in the repository, index, and working tree),
       commands that interrogate and compare objects, and commands that move
       objects and references between repositories.

   Manipulation commands
       git-apply(1)
           Apply a patch to files and/or to the index.

       git-checkout-index(1)
           Copy files from the index to the working tree.

       git-commit-tree(1)
           Create a new commit object.

       git-hash-object(1)
           Compute object ID and optionally creates a blob from a file.

       git-index-pack(1)
           Build pack index file for an existing packed archive.

       git-merge-file(1)
           Run a three-way file merge.

       git-merge-index(1)
           Run a merge for files needing merging.

       git-mktag(1)
           Creates a tag object.

       git-mktree(1)
           Build a tree-object from ls-tree formatted text.

       git-pack-objects(1)
           Create a packed archive of objects.

       git-prune-packed(1)
           Remove extra objects that are already in pack files.

       git-read-tree(1)
           Reads tree information into the index.

       git-symbolic-ref(1)
           Read, modify and delete symbolic refs.

       git-unpack-objects(1)
           Unpack objects from a packed archive.

       git-update-index(1)
           Register file contents in the working tree to the index.

       git-update-ref(1)
           Update the object name stored in a ref safely.

       git-write-tree(1)
           Create a tree object from the current index.

   Interrogation commands
       git-cat-file(1)
           Provide content or type and size information for repository
           objects.

       git-diff-files(1)
           Compares files in the working tree and the index.

       git-diff-index(1)
           Compare a tree to the working tree or index.

       git-diff-tree(1)
           Compares the content and mode of blobs found via two tree objects.

       git-for-each-ref(1)
           Output information on each ref.

       git-ls-files(1)
           Show information about files in the index and the working tree.

       git-ls-remote(1)
           List references in a remote repository.

       git-ls-tree(1)
           List the contents of a tree object.

       git-merge-base(1)
           Find as good common ancestors as possible for a merge.

       git-name-rev(1)
           Find symbolic names for given revs.

       git-pack-redundant(1)
           Find redundant pack files.

       git-rev-list(1)
           Lists commit objects in reverse chronological order.

       git-show-index(1)
           Show packed archive index.

       git-show-ref(1)
           List references in a local repository.

       git-unpack-file(1)
           Creates a temporary file with a blob’s contents.

       git-var(1)
           Show a Git logical variable.

       git-verify-pack(1)
           Validate packed Git archive files.

       In general, the interrogate commands do not touch the files in the
       working tree.

   Synching repositories
       git-daemon(1)
           A really simple server for Git repositories.

       git-fetch-pack(1)
           Receive missing objects from another repository.

       git-http-backend(1)
           Server side implementation of Git over HTTP.

       git-send-pack(1)
           Push objects over Git protocol to another repository.

       git-update-server-info(1)
           Update auxiliary info file to help dumb servers.

       The following are helper commands used by the above; end users
       typically do not use them directly.

       git-http-fetch(1)
           Download from a remote Git repository via HTTP.

       git-http-push(1)
           Push objects over HTTP/DAV to another repository.

       git-parse-remote(1)
           Routines to help parsing remote repository access parameters.

       git-receive-pack(1)
           Receive what is pushed into the repository.

       git-shell(1)
           Restricted login shell for Git-only SSH access.

       git-upload-archive(1)
           Send archive back to git-archive.

       git-upload-pack(1)
           Send objects packed back to git-fetch-pack.

   Internal helper commands
       These are internal helper commands used by other commands; end users
       typically do not use them directly.

       git-check-attr(1)
           Display gitattributes information.

       git-check-ignore(1)
           Debug gitignore / exclude files.

       git-check-mailmap(1)
           Show canonical names and email addresses of contacts.

       git-check-ref-format(1)
           Ensures that a reference name is well formed.

       git-column(1)
           Display data in columns.

       git-credential(1)
           Retrieve and store user credentials.

       git-credential-cache(1)
           Helper to temporarily store passwords in memory.

       git-credential-store(1)
           Helper to store credentials on disk.

       git-fmt-merge-msg(1)
           Produce a merge commit message.

       git-mailinfo(1)
           Extracts patch and authorship from a single e-mail message.

       git-mailsplit(1)
           Simple UNIX mbox splitter program.

       git-merge-one-file(1)
           The standard helper program to use with git-merge-index.

       git-patch-id(1)
           Compute unique ID for a patch.

       git-sh-i18n(1)
           Git’s i18n setup code for shell scripts.

       git-sh-setup(1)
           Common Git shell script setup code.

       git-stripspace(1)
           Remove unnecessary whitespace.

Rendez-vous sur mon site présentant mes créations open-source: http://www.open-source-projects.net/
Rendez-vous sur mon site dédier a mes créations d'imagerie 3D: http://www.3dreaming-imaging.net/
Testez pendant une semaine l'éditeur avec terminaux intégrées http://www.open-source-projects.net/it-edit/it-edit Vous l'adopterai sûrement !

Hors ligne

#2 Le 27/07/2015, à 08:15

k3c

Re : besoin d'aide pour utilisation de git.

Bonjour

Je ne suis pas capable de t'apporter une réponse, mais le meilleur tutoriel pour git (à mon humble avis) est

http://www.miximum.fr/enfin-comprendre-git.html


Archlinux sur Xiaomi Air 13

Hors ligne

#3 Le 28/07/2015, à 14:28

ssdg

Re : besoin d'aide pour utilisation de git.

Hors Sujet: Ouuu, le post qui a des chances de dégénérer en "j'essaie de faire un truc technique mais je n'ai pas envie de m'intéresser à des trucs de barbus intégristes"...

Dans le Sujet: J'ai l'impression que ce que tu décris c'est quand même grandement ce que fait un git push. J'ai encore un peu de mal avec les fondamentaux (les branches, les détails de quand ça marche et quand ça échoue)

Mais j'ai aussi l'impression que tu ne maitrise pas le:
git add [dossier ou fichier]
et le
git commit

jette un oeil à tout ça wink


s'il n'y a pas de solution, c'est qu'il n'y a pas de problème... ou pas.

Hors ligne

#4 Le 28/07/2015, à 16:57

cervo

Re : besoin d'aide pour utilisation de git.

Bon, un tuto vite fait (mal fait tongue)

Partons du principe que tu veuilles commiter dans un repo créé sur bitbucket (au hasard, parce que c'est gratos et que tu peux faire des repo privés).
Tu commences par créer ton repo dans bitbucket (nommons-le testgit)

Sur ta machine :

$ mkdir testgit
$ mkdir images
$ touch images/file1.jpg
$ touch fichierracine.txt
$ ls
=> fichierracine.txt images
$ ls images 
=> file1.jpg

Tu as donc un dossier "testgit" dans lequel existe un fichier fichierracine.txt et un sous-dossier "images" contenant "file1.jpg".

Tu commences par initialiser git

$ git init .
=> Initialized empty Git repository in /Users/user/Desktop/testgit/.git/
$ git status

On branch master

Initial commit

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	fichierracine.txt
	images/

nothing added to commit but untracked files present (use "git add" to track)

A ce stage là, tu n'as rien dans ton repository et git ne sait même pas où pusher.
Ajoutons-lui le repo :

git remote add origin git@bitbucket.org:user/testgit.git

Ajoutons le fichier à la racine :

$ git add fichierracine.txt

et ajoutons récursivement le dossier images et son contenu

$ git add images/
$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

	new file:   fichierracine.txt
	new file:   images/file1.jpg

Nommons notre commit

$ git commit -m 'Initial commit'

et pushons sur le serveur

$ git push
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 299 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To git@bitbucket.org:user/testgit.git
 * [new branch]      master -> master

On est alors synchro avec le repo :

$ git status
On branch master
nothing to commit, working directory clean

Maintenant tu veux ajouter une image :

$ touch images/file2.jpg
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	images/file2.jpg

On voit que tu as un nouveau fichier que le repo ne connais pas.
Il faut donc l'ajouter :

$ git add images/file2.jpg

puis nommer ton commit

$ git commit -m 'ajout file2'

et enfin pusher

$ git push

et tu es de nouveau synchro, et ainsi de suite.

Voilà, tu devrais pouvoir t'en sortir pour faire des modifs basiques de ton repo.

Hors ligne

#5 Le 29/07/2015, à 21:07

ubuntuforce

Re : besoin d'aide pour utilisation de git.

Merci pour vos réponses éclairées,

Au sujet de mon intérêt pour les truc de barbue je n'ai jamais dit que je n'avait pas chercher en commençant par la manpage de git mais il est vrai que j'ai vite abandonner face a la masse de commandes...

Les première instructions qu'a présenter cervo:
c.a.d créer le dépôt en locale (git init) puis de pusher après avoir additionner et commit les fichiers je sais le faire puisque j'ai dit que je réinitialiser les dépôts pour les update.
Mais j'ai tendance a effacer le dossier locale grâce auquel j'ai créer le dépôt après que j'en ai finit (pour cette fois-ci).

Donc si je veux ajouter un fichier|dossier je ne devrai pas.

Puis sinon quand j'essaie de me connecter a un dépôt qui existe déjà il me dit justement que le dépôt existe déjà et donc retourne une erreur...

PS: est-il possible en ayant créer un dépôt puis effacer le dossier git correspondant après en avoir finit (pour l'instant) de se connecter après a ce dépôt afin de faire diverses opérations ?

Dernière modification par ubuntuforce (Le 29/07/2015, à 21:09)


Rendez-vous sur mon site présentant mes créations open-source: http://www.open-source-projects.net/
Rendez-vous sur mon site dédier a mes créations d'imagerie 3D: http://www.3dreaming-imaging.net/
Testez pendant une semaine l'éditeur avec terminaux intégrées http://www.open-source-projects.net/it-edit/it-edit Vous l'adopterai sûrement !

Hors ligne

#6 Le 29/07/2015, à 21:16

tiramiseb

Re : besoin d'aide pour utilisation de git.

Mais j'ai tendance a effacer le dossier locale grâce auquel j'ai créer le dépôt après que j'en ai finit (pour cette fois-ci).

Donc si je veux ajouter un fichier|dossier je ne devrai pas.

Tu peux très bien effacer, pour ensuite faire un "git clone" pour récupérer le contenu du dépôt sur ton PC...

Hors ligne

#7 Le 30/07/2015, à 09:21

cervo

Re : besoin d'aide pour utilisation de git.

ubuntuforce a écrit :

Puis sinon quand j'essaie de me connecter a un dépôt qui existe déjà il me dit justement que le dépôt existe déjà et donc retourne une erreur...

Ben si tu récupère en local un repo déjà existant, effectivement, comme écrit @tiramiseb, faut que tu

git clone 

le repo, que tu fasses tes modifs et que tu le push dans un repo qui t'appartient (ou dans master si il t'appartient déjà).
En fait, je crois que je n'ai pas très bien compris ce que tu souhaitais vraiment faire avec git. Peut-être que tu peux nous expliquer, de A à Z? avec des exemples concrets?

Dernière modification par cervo (Le 30/07/2015, à 09:21)

Hors ligne

#8 Le 31/07/2015, à 20:49

grim7reaper

Re : besoin d'aide pour utilisation de git.

Salut,

Cette page (en anglais) est assez sympa pour apprendre Git de manière interactive.

Hors ligne